Documentation ¶
Index ¶
Constants ¶
const ( Initializing = iota StateSyncing Bootstrapping NormalOp )
Variables ¶
var ErrUnknownState = errors.New("unknown state")
Functions ¶
This section is empty.
Types ¶
type Acceptor ¶
type Acceptor interface { // Accept must be called before [containerID] is committed to the VM as // accepted. // // 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(ctx *ConsensusContext, containerID ids.ID, container []byte) error }
Acceptor is implemented when a struct is monitoring if a message is accepted
type AcceptorGroup ¶ added in v1.8.4
type AcceptorGroup interface { // Calling Accept() calls all of the registered acceptors for the relevant // chain. Acceptor // RegisterAcceptor causes [acceptor] to be called every time an operation // is accepted on chain [chainID]. // If [dieOnError], chain [chainID] stops if Accept returns a non-nil error. RegisterAcceptor(chainID ids.ID, acceptorName string, acceptor Acceptor, dieOnError bool) error // DeregisterAcceptor removes an acceptor from the group. DeregisterAcceptor(chainID ids.ID, acceptorName string) error }
func NewAcceptorGroup ¶ added in v1.8.4
func NewAcceptorGroup(log logging.Logger) AcceptorGroup
type AcceptorTracker ¶ added in v1.8.4
type AcceptorTracker struct {
// contains filtered or unexported fields
}
AcceptorTracker tracks the dispatched accept events by its ID and counts. Useful for testing.
func NewAcceptorTracker ¶ added in v1.8.4
func NewAcceptorTracker() *AcceptorTracker
func (*AcceptorTracker) Accept ¶ added in v1.8.4
func (a *AcceptorTracker) Accept(ctx *ConsensusContext, containerID ids.ID, container []byte) error
func (*AcceptorTracker) IsAccepted ¶ added in v1.8.4
func (a *AcceptorTracker) IsAccepted(containerID ids.ID) (int, bool)
type ConsensusContext ¶
type ConsensusContext struct { *Context Registerer Registerer // DecisionAcceptor is the callback that will be fired whenever a VM is // notified that their object, either a block in snowman or a transaction // in avalanche, was accepted. DecisionAcceptor Acceptor // ConsensusAcceptor is the callback that will be fired whenever a // container, either a block in snowman or a vertex in avalanche, was // accepted. ConsensusAcceptor Acceptor // contains filtered or unexported fields }
func DefaultConsensusContextTest ¶
func DefaultConsensusContextTest() *ConsensusContext
func (*ConsensusContext) Executing ¶
func (ctx *ConsensusContext) Executing(b bool)
Executing marks this chain as executing or not. Set to "true" if there's an ongoing transaction.
func (*ConsensusContext) GetState ¶
func (ctx *ConsensusContext) GetState() State
func (*ConsensusContext) IsExecuting ¶
func (ctx *ConsensusContext) IsExecuting() bool
IsExecuting returns true iff this chain is still executing transactions.
func (*ConsensusContext) IsValidatorOnly ¶
func (ctx *ConsensusContext) IsValidatorOnly() bool
IsValidatorOnly returns true iff this chain is available only to validators
func (*ConsensusContext) SetState ¶
func (ctx *ConsensusContext) SetState(newState State)
func (*ConsensusContext) SetValidatorOnly ¶
func (ctx *ConsensusContext) SetValidatorOnly()
SetValidatorOnly marks this chain as available only to validators
type Context ¶
type Context struct { NetworkID uint32 SubnetID ids.ID ChainID ids.ID NodeID ids.NodeID XChainID ids.ID AVAXAssetID ids.ID Log logging.Logger Lock sync.RWMutex Keystore keystore.BlockchainKeystore BCLookup ids.AliaserReader SNLookup SubnetLookup Metrics metrics.OptionalGatherer // snowman++ attributes ValidatorState validators.State // interface for P-Chain validators StakingLeafSigner crypto.Signer // block signer StakingCertLeaf *x509.Certificate // block certificate StakingBLSKey *bls.SecretKey // bls signer }
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
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 Registerer ¶ added in v1.8.4
type Registerer interface { prometheus.Registerer prometheus.Gatherer }
Expose gatherer interface for unit testing.
Directories ¶
Path | Synopsis |
---|---|
consensus
|
|
snowman
Package snowman is a generated GoMock package.
|
Package snowman is a generated GoMock package. |
engine
|
|
avalanche
Package avalanche is a generated GoMock package.
|
Package avalanche is a generated GoMock package. |
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. |
avalanche/vertex
Package vertex is a generated GoMock package.
|
Package vertex is a generated GoMock package. |
common
Package common is a generated GoMock package.
|
Package common is a generated GoMock package. |
snowman
Package snowman is a generated GoMock package.
|
Package snowman is a generated GoMock package. |
snowman/block/mocks
Package mocks is a generated GoMock package.
|
Package mocks is a generated GoMock package. |
networking
|
|
tracker
Package tracker is a generated GoMock package.
|
Package tracker is a generated GoMock package. |
Package uptime is a generated GoMock package.
|
Package uptime is a generated GoMock package. |