executor

package
v1.8.6-rc.4 Latest Latest
Warning

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

Go to latest
Published: Sep 21, 2022 License: BSD-3-Clause Imports: 19 Imported by: 0

README

Package executor

This package deals with state management for P-Chain blocks.

*Block

The *Block type implements the snowman.Block interface. This is the type that the platformvm deals with when it uses snowman.Blocks. *Block wraps a blocks.Block and a manager. The *Block itself doesn't have any state. The state is all held by the manager, and the *Block acts upon the manager to get/set the state. Therefore, we don't need to worry about deduplicating *Block instances.

The platformvm uses the manager to create blocks and query block state because the manager.GetBlock returns a stateful block (*Block), whereas state.State's GetStatelessBlock returns a blocks.Block.

Visitors

This package contains three implementations of blocks.Visitor: verifier, acceptor and rejector. These implement the logic for verifying, accepting and rejecting blocks. Each implementation has a reference to a shared *backend, which maintains state, etc. (The manager has a reference to the shared *backend as well.)

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Block

type Block struct {
	blocks.Block
	// contains filtered or unexported fields
}

Exported for testing in platformvm package.

func (*Block) Accept

func (b *Block) Accept() error

func (*Block) Options

func (b *Block) Options() ([2]snowman.Block, error)

func (*Block) Reject

func (b *Block) Reject() error

func (*Block) Status

func (b *Block) Status() choices.Status

func (*Block) Timestamp

func (b *Block) Timestamp() time.Time

func (*Block) Verify

func (b *Block) Verify() error

type Manager

type Manager interface {
	state.Versions

	// Returns the ID of the most recently accepted block.
	LastAccepted() ids.ID
	GetBlock(blkID ids.ID) (snowman.Block, error)
	GetStatelessBlock(blkID ids.ID) (blocks.Block, error)
	NewBlock(blocks.Block) snowman.Block
}

func NewManager

func NewManager(
	mempool mempool.Mempool,
	metrics metrics.Metrics,
	s state.State,
	txExecutorBackend *executor.Backend,
	recentlyAccepted window.Window[ids.ID],
) Manager

Jump to

Keyboard shortcuts

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