Documentation ¶
Overview ¶
Context summarizes the various components of a node.
The struct presented here is extended with a number of simple utility functions for the RunMode. Placing the RunMode here is more convenient than handling it like the more complex components.
The interfaces presented here summarize the complex interaction of various components of a node.
Index ¶
Constants ¶
View Source
const ( // Nyzo style Verifier. RunModeVerifier = 0 // Nyzo style Sentinel. RunModeSentinel = 1 // Nyzo style Client. RunModeClient = 2 // Nyzo style Micropay Client. RunModeMicropayClient = 3 // Nyzo style Micropay Server. RunModeMicropayServer = 4 // Nyzo style Documentation Server. RunModeDocumentationServer = 5 // Go style Archive Node. RunModeArchive = 100 )
Variables ¶
This section is empty.
Functions ¶
func GetRunModeId ¶
Nyzo style ID (aka "override suffix") for run modes.
Types ¶
type BlockAuthorityInterface ¶
type BlockAuthorityInterface interface { Component // Do a full verification of this block: signature (including transactions) and continuity. BlockIsValid(block *blockchain_data.Block) bool // Get the genesis block hash, used for seed transactions. GetGenesisBlockHash() []byte }
type BlockFileHandlerInterface ¶
type BlockFileHandlerInterface interface { Component // Get a block. GetBlock(height int64) *blockchain_data.Block // Get multiple blocks in continuous order. GetBlocks(heightFrom, heightTo int64) ([]*blockchain_data.Block, error) // Load a balance list for the given height, only works if we have an individual block file for that height (for now). GetBalanceList(blockHeight int64) *blockchain_data.BalanceList // Commit a new frozen edge block. This is blocking and can take a significant amount of time during startup (especially for the archive node). CommitFrozenEdgeBlock(block *blockchain_data.Block, balanceList *blockchain_data.BalanceList) // Inform the file handler that the chain is fully initialized SetChainIsInitialized() }
type Component ¶
type Component interface { // Initialize component Initialize() error // Start component/enter main loop if needed Start() }
Listen only component.
type Context ¶
type Context struct { WaitGroup sync.WaitGroup Identity *identity.Identity PersistentData KeyValueStoreInterface Preferences KeyValueStoreInterface BlockFileHandler BlockFileHandlerInterface CycleAuthority CycleAuthorityInterface BlockAuthority BlockAuthorityInterface TransactionManager TransactionManagerInterface MeshListener MeshListenerInterface NodeManager NodeManagerInterface DataStore Component // contains filtered or unexported fields }
The blockchain context. See Readme.
func (*Context) SetRunMode ¶
Run mode should only be set during startup. Default: verifier.
type CycleAuthorityInterface ¶
type CycleAuthorityInterface interface { Component GetCurrentCycleLength() int // returns the current cycle length VerifierInCurrentCycle(id []byte) bool // returns true if the verifier with this id is currently in the cycle GetCycleInformationForBlock(block *blockchain_data.Block) *blockchain_data.CycleInformation // get cycle information for this block DetermineContinuityForBlock(block *blockchain_data.Block) int // determine this block's continuity (diversity) state HasCycleAt(block *blockchain_data.Block) bool // returns "true" if we know the cycle at the given block }
type KeyValueStoreInterface ¶
type MeshListenerInterface ¶
type MeshListenerInterface interface { Component }
type NodeManagerInterface ¶
type NodeManagerInterface interface { Component // Are we accepting messages from this peer? Used to quickly terminate a connection. AcceptingMessagesFrom(ip string) bool // Are we accepting messages of this type from this peer? Used to quickly terminate connections. AcceptingMessageTypeFrom(ip string, messageType int16) bool // Get a list of trusted entry points. GetTrustedEntryPoints() []*networking.TrustedEntryPoint // Get a list of managed verifiers. GetManagedVerifiers() []*networking.ManagedVerifier }
type TransactionManagerInterface ¶
type TransactionManagerInterface interface { Component // Returns only valid transactions from the given list, including signature, duplicate and malleability check. // Hence the startTimestamp: only transactions between startTimestamp and startTimestamp + BlockDuration are allowed into a block. ValidTransactionsOnly(transactions []*blockchain_data.Transaction, startTimestamp int64) []*blockchain_data.Transaction SeedTransactionForBlock(height int64) *blockchain_data.Transaction }
Click to show internal directories.
Click to hide internal directories.