Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrUnknownState = errors.New("unknown state")
Functions ¶
This section is empty.
Types ¶
type Acceptor ¶ added in v1.7.3
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.7.11
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.7.11
func NewAcceptorGroup(log logging.Logger) AcceptorGroup
type ConsensusContext ¶ added in v1.7.0
type ConsensusContext struct {
*Context
// Registers all common and snowman consensus metrics. Unlike the avalanche
// consensus engine metrics, we do not prefix the name with the engine name,
// as snowman is used for all chains by default.
Registerer Registerer
// Only used to register Avalanche consensus metrics. Previously, all
// metrics were prefixed with "avalanche_{chainID}_". Now we add avalanche
// to the prefix, "avalanche_{chainID}_avalanche_", to differentiate
// consensus operations after the DAG linearization.
AvalancheRegisterer Registerer
// BlockAcceptor is the callback that will be fired whenever a VM is
// notified that their block was accepted.
BlockAcceptor Acceptor
// TxAcceptor is the callback that will be fired whenever a VM is notified
// that their transaction was accepted.
TxAcceptor Acceptor
// VertexAcceptor is the callback that will be fired whenever a vertex was
// accepted.
VertexAcceptor Acceptor
// State indicates the current state of this consensus instance.
State utils.Atomic[EngineState]
// True iff this chain is executing transactions as part of bootstrapping.
Executing utils.Atomic[bool]
// True iff this chain is currently state-syncing
StateSyncing utils.Atomic[bool]
}
type Context ¶
type Context struct {
NetworkID uint32
SubnetID ids.ID
ChainID ids.ID
NodeID ids.NodeID
PublicKey *bls.PublicKey
XChainID ids.ID
CChainID ids.ID
AVAXAssetID ids.ID
Log logging.Logger
Lock sync.RWMutex
Keystore keystore.BlockchainKeystore
BCLookup ids.AliaserReader
Metrics metrics.OptionalGatherer
WarpSigner warp.Signer
// snowman++ attributes
ValidatorState validators.State // interface for P-Chain validators
// Chain-specific directory where arbitrary data can be written
ChainDataDir string
}
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
type ContextInitializable ¶ added in v1.4.12
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 EngineState ¶ added in v1.9.8
type EngineState struct {
Type p2p.EngineType
State State
}
type Registerer ¶ added in v1.7.14
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/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/block
Package block is a generated GoMock package.
|
Package block is a generated GoMock package. |
|
networking
|
|
|
handler
Package handler is a generated GoMock package.
|
Package handler is a generated GoMock package. |
|
router
Package router is a generated GoMock package.
|
Package router is a generated GoMock package. |
|
sender
Package sender is a generated GoMock package.
|
Package sender is a generated GoMock package. |
|
timeout
Package timeout is a generated GoMock package.
|
Package timeout is a generated GoMock package. |
|
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. |
|
Package validators is a generated GoMock package.
|
Package validators is a generated GoMock package. |
Click to show internal directories.
Click to hide internal directories.