Documentation
¶
Overview ¶
Package chainread reads a bdns chain from an overlay host and believes nothing the host says: every token is decoded and held to the chain's rules from seq 0, and every leaves object to the state that commits to it. The command's reads and the renderer both use it.
Index ¶
- func Ask(ctx context.Context, host string, q module.Query) (typ string, body []byte, err error)
- func CheckNumber(label string) string
- func Freeform(ctx context.Context, host string, q module.Query, v any) (bool, error)
- func Outputs(ctx context.Context, host string, q module.Query) ([]lookup.Output, error)
- type Reader
- type Seen
- type VerifyError
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CheckNumber ¶
CheckNumber is the check of spec section 8 a label is refused by.
Types ¶
type Reader ¶
type Reader struct {
Host string
Zone [32]byte
Headers chaintracker.ChainTracker
// Proof, when set, asks the reader's own chain view whether a token
// mined: a host may hold a mined token in the form it first took.
Proof func(ctx context.Context, txid string) (*transaction.MerklePath, uint32, error)
// Chain is the states read and verified, from seq 0.
Chain []*Seen
// contains filtered or unexported fields
}
Reader reads one chain from one host.
func (*Reader) Extend ¶
Extend reads the states from seq on and verifies each after the one before it. A state is mined when its own BEEF proves it, when the state after it carries its proof, or when the reader's chain view has one. It returns the first seq that is new, replaced or newly known mined: the chain's length when nothing changed.
type Seen ¶
type Seen struct {
St *zonerec.State
Tx *transaction.Transaction
Vout uint32
Beef []byte
Mined bool
Height uint32
}
Seen is one state as a host answered it: its token, and whether the token's BEEF proves it.
func ReadLog ¶
func ReadLog(ctx context.Context, host string, zone [32]byte, from uint64, limit int) ([]*Seen, error)
ReadLog asks for the states from seq, at most limit, and decodes each token. It verifies nothing.
func (*Seen) Outpoint ¶
func (s *Seen) Outpoint() transaction.Outpoint
Outpoint is the token's outpoint.
type VerifyError ¶
type VerifyError struct {
// contains filtered or unexported fields
}
VerifyError is what a host answered that does not verify.
func (*VerifyError) Error ¶
func (e *VerifyError) Error() string
func (*VerifyError) Unwrap ¶
func (e *VerifyError) Unwrap() error