chain
Package chain
import "github.com/luxfi/node/vms/components/chain"Types
BlockWrapper
BlockWrapper wraps a linear Block while adding a smart caching layer to improve VM performance.
func (bw *BlockWrapper) Accept(ctx context.Context) errorfunc (bw *BlockWrapper) Reject(ctx context.Context) errorfunc (bw *BlockWrapper) ShouldVerifyWithRuntime(ctx context.Context) (bool, error)func (bw *BlockWrapper) Verify(ctx context.Context) errorfunc (bw *BlockWrapper) VerifyWithRuntime(ctx context.Context, blockCtx *runtime.Runtime) errorConfig
Config defines all of the parameters necessary to initialize State
OracleBlock
OracleBlock is a block that can have multiple valid children, and one needs to be chosen by an oracle.
State
State implements an efficient caching layer used to wrap a VM implementation.
func NewMeteredState(
registerer metric.Registerer,
config *Config,
) (*State, error)func NewState(config *Config) *Statefunc (s *State) BatchedParseBlock(ctx context.Context, blksBytes [][]byte) ([]consensuschain.Block, error)func (s *State) BuildBlock(ctx context.Context) (consensuschain.Block, error)func (s *State) BuildBlockWithRuntime(ctx context.Context, blockCtx *runtime.Runtime) (consensuschain.Block, error)func (s *State) Flush()func (s *State) GetBlock(ctx context.Context, blkID ids.ID) (consensuschain.Block, error)func (s *State) GetBlockInternal(ctx context.Context, blkID ids.ID) (consensuschain.Block, error)func (s *State) IsProcessing(blkID ids.ID) boolfunc (s *State) LastAccepted(context.Context) (ids.ID, error)func (s *State) LastAcceptedBlock() *BlockWrapperfunc (s *State) LastAcceptedBlockInternal() consensuschain.Blockfunc (s *State) ParseBlock(ctx context.Context, b []byte) (consensuschain.Block, error)func (s *State) SetLastAcceptedBlock(lastAcceptedBlock consensuschain.Block) errorStatus
Status represents the status of a block
TestBlock
TestBlock is a test implementation of Block
func (b *TestBlock) Accept(context.Context) errorfunc (b *TestBlock) Bytes() []bytefunc (b *TestBlock) Height() uint64func (b *TestBlock) ID() ids.IDfunc (b *TestBlock) Parent() ids.IDfunc (b *TestBlock) ParentID() ids.IDfunc (b *TestBlock) Reject(context.Context) errorfunc (b *TestBlock) State() state.ReadOnlyChainfunc (b *TestBlock) Status() uint8func (b *TestBlock) Timestamp() time.Timefunc (b *TestBlock) Verify(context.Context) error