snow

package
v0.3.1 Latest Latest
Warning

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

Go to latest
Published: Nov 24, 2021 License: BSD-3-Clause Imports: 12 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Context

type Context struct {
	NetworkID uint32
	SubnetID  ids.ID
	ChainID   ids.ID
	NodeID    ids.ShortID

	XChainID    ids.ID
	AVAXAssetID ids.ID

	Log                 logging.Logger
	DecisionDispatcher  EventDispatcher
	ConsensusDispatcher EventDispatcher
	Lock                sync.RWMutex
	Keystore            keystore.BlockchainKeystore
	SharedMemory        atomic.SharedMemory
	BCLookup            ids.AliaserReader
	SNLookup            SubnetLookup
	Namespace           string
	Metrics             prometheus.Registerer

	// Epoch management
	EpochFirstTransition time.Time
	EpochDuration        time.Duration
	Clock                mockable.Clock

	// snowman++ attributes
	ValidatorState    validators.State  // interface for P-Chain validators
	StakingLeafSigner crypto.Signer     // block signer
	StakingCertLeaf   *x509.Certificate // block certificate
	// contains filtered or unexported fields
}

Context is information about the current execution. [NetworkID] is the ID of the network this context exists within. [ChainID] is the ID of the chain this context exists within. [NodeID] is the ID of this node

func DefaultContextTest

func DefaultContextTest() *Context

func (*Context) Bootstrapped

func (ctx *Context) Bootstrapped()

Bootstrapped marks this chain as done bootstrapping

func (*Context) Epoch

func (ctx *Context) Epoch() uint32

Epoch this context thinks it's in based on the wall clock time.

func (*Context) Executing added in v0.2.3

func (ctx *Context) Executing(b bool)

Executing marks this chain as executing or not. Set to "true" if there's an ongoing transaction.

func (*Context) IsBootstrapped

func (ctx *Context) IsBootstrapped() bool

IsBootstrapped returns true iff this chain is done bootstrapping

func (*Context) IsExecuting added in v0.2.3

func (ctx *Context) IsExecuting() bool

IsExecuting returns true iff this chain is still executing transactions.

func (*Context) IsValidatorOnly added in v0.2.3

func (ctx *Context) IsValidatorOnly() bool

IsValidatorOnly returns true iff this chain is available only to validators

func (*Context) SetValidatorOnly added in v0.2.3

func (ctx *Context) SetValidatorOnly()

SetValidatorOnly marks this chain as available only to validators

type ContextInitializable

type ContextInitializable interface {
	// InitCtx initializes an object provided a *Context object
	InitCtx(ctx *Context)
}

ContextInitializable represents an object that can be initialized given a *Context object

type EventDispatcher

type EventDispatcher interface {
	Issue(ctx *Context, containerID ids.ID, container []byte) error
	// If the returned error is non-nil, the chain associated with [ctx] should shut
	// down and not commit [container] or any other container to its database as accepted.
	// Accept must be called before [containerID] is committed to the VM as accepted.
	Accept(ctx *Context, containerID ids.ID, container []byte) error
	Reject(ctx *Context, containerID ids.ID, container []byte) error
}

type SubnetLookup

type SubnetLookup interface {
	SubnetID(chainID ids.ID) (ids.ID, error)
}

Directories

Path Synopsis
consensus
engine
avalanche/state
Package state manages the meta-data required by consensus for an avalanche dag.
Package state manages the meta-data required by consensus for an avalanche dag.
networking

Jump to

Keyboard shortcuts

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