header

package
v0.5.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 28, 2024 License: Apache-2.0 Imports: 7 Imported by: 3

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type API

type API struct {
	// LocalHead returns the ExtendedHeader of the chain head.
	LocalHead func(context.Context) (*ExtendedHeader, error) `perm:"read"`
	// GetByHash returns the header of the given hash from the node's header store.
	GetByHash func(
		ctx context.Context,
		hash libhead.Hash,
	) (*ExtendedHeader, error) `perm:"read"`
	// GetRangeByHeight returns the given range (from:to) of ExtendedHeaders
	// from the node's header store and verifies that the returned headers are
	// adjacent to each other.
	GetRangeByHeight func(
		context.Context,
		*ExtendedHeader,
		uint64,
	) ([]*ExtendedHeader, error) `perm:"read"`
	// GetByHeight returns the ExtendedHeader at the given height if it is
	// currently available.
	GetByHeight func(context.Context, uint64) (*ExtendedHeader, error) `perm:"read"`
	// WaitForHeight blocks until the header at the given height has been processed
	// by the store or context deadline is exceeded.
	WaitForHeight func(context.Context, uint64) (*ExtendedHeader, error) `perm:"read"`
	// SyncState returns the current state of the header Syncer.
	SyncState func(ctx context.Context) (sync.State, error) `perm:"read"`
	// SyncWait blocks until the header Syncer is synced to network head.
	SyncWait func(ctx context.Context) error `perm:"read"`
	// NetworkHead provides the Syncer's view of the current network head.
	NetworkHead func(ctx context.Context) (*ExtendedHeader, error) `perm:"read"`
	// Subscribe to recent ExtendedHeaders from the network.
	Subscribe func(ctx context.Context) (<-chan *ExtendedHeader, error) `perm:"read"`
}

type DataAvailabilityHeader

type DataAvailabilityHeader = core.DataAvailabilityHeader

type ExtendedHeader

type ExtendedHeader struct {
	RawHeader    `json:"header"`
	Commit       *core.Commit            `json:"commit"`
	ValidatorSet *core.ValidatorSet      `json:"validator_set"`
	DAH          *DataAvailabilityHeader `json:"dah"`
}

ExtendedHeader represents a wrapped "raw" header that includes information necessary for Celestia Nodes to be notified of new block headers and perform Data Availability Sampling.

func (*ExtendedHeader) ChainID

func (eh *ExtendedHeader) ChainID() string

func (*ExtendedHeader) Hash

func (eh *ExtendedHeader) Hash() header.Hash

func (*ExtendedHeader) Height

func (eh *ExtendedHeader) Height() uint64

func (*ExtendedHeader) IsZero

func (eh *ExtendedHeader) IsZero() bool

func (*ExtendedHeader) LastHeader

func (eh *ExtendedHeader) LastHeader() header.Hash

func (*ExtendedHeader) MarshalBinary

func (eh *ExtendedHeader) MarshalBinary() (data []byte, err error)

func (*ExtendedHeader) MarshalJSON

func (eh *ExtendedHeader) MarshalJSON() ([]byte, error)

MarshalJSON marshals an ExtendedHeader to JSON. The ValidatorSet is wrapped with amino encoding, to be able to unmarshal the crypto.PubKey type back from JSON.

func (*ExtendedHeader) New

func (eh *ExtendedHeader) New() *ExtendedHeader

func (*ExtendedHeader) Time

func (eh *ExtendedHeader) Time() time.Time

func (*ExtendedHeader) UnmarshalBinary

func (eh *ExtendedHeader) UnmarshalBinary(data []byte) error

func (*ExtendedHeader) UnmarshalJSON

func (eh *ExtendedHeader) UnmarshalJSON(data []byte) error

UnmarshalJSON unmarshals an ExtendedHeader from JSON. The ValidatorSet is wrapped with amino encoding, to be able to unmarshal the crypto.PubKey type back from JSON.

func (*ExtendedHeader) Validate

func (eh *ExtendedHeader) Validate() error

func (*ExtendedHeader) Verify

func (eh *ExtendedHeader) Verify(h *ExtendedHeader) error

type RawHeader

type RawHeader = core.Header

RawHeader is an alias to core.Header. It is "raw" because it is not yet wrapped to include the DataAvailabilityHeader.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL