Class Validator
Implementation of the Validator node
This class implement the business code of the node.
Communication with the other nodes is handled by the Network
class.
Constructors
Name | Description |
---|---|
this
(config)
|
Ctor |
Fields
Name | Type | Description |
---|---|---|
nominator
|
Nominator | Nominator instance |
qc
|
QuorumConfig | Currently active quorum configuration |
quorum_params
|
QuorumParams | Quorum generator parameters |
required_peer_utxos
|
UTXO[geod24 | The current required set of peers UTXOs to connect to |
app_stats
|
Stats!(agora.stats.App.ApplicationStatsValue,agora.stats.App.ApplicationStatsLabels) | Persistence-related fields |
block_handlers
|
agora | List of handlers for specific actions |
block_header_handlers
|
agora | List of handlers for specific actions |
cacheDB
|
ManagedDatabase | Persistence-related fields |
clock
|
Clock | Clock instance |
config
|
Config | Config instance |
endpoint_request_stats
|
Stats!(agora.stats.EndpointReq.EndpointReqStatsValue,agora.stats.EndpointReq.EndpointReqStatsLabel) | Persistence-related fields |
enroll_man
|
EnrollmentManager | Enrollment manager |
is_shutting_down
|
bool | Node is shutting down |
ledger
|
NodeLedger | The Ledger is the main class driving consensus |
log
|
Logger | Logger instance |
network
|
NetworkManager | Network of connected nodes |
params
|
immutable(ConsensusParams) | Parameters for consensus-critical constants |
pool
|
TransactionPool | Transaction pool |
preimage_handlers
|
agora | List of handlers for specific actions |
registry
|
NameRegistry | Name registry, if enabled for this node |
stateDB
|
ManagedDatabase | Persistence-related fields |
storage
|
IBlockStorage | Persistence-related fields |
taskman
|
ITaskManager | Task manager |
timers
|
ITimer[int] | Timers this node has started |
transaction_handlers
|
agora | List of handlers for specific actions |
transaction_relayer
|
TransactionRelayer | Transaction relayer |
Methods
Name | Description |
---|---|
getPublicKey
(key)
|
GET /public_key |
getSCPState
()
|
|
getTxSet
(hash)
|
Set of TX hashes represented by the given hash |
handshake
(peer)
|
|
makeAdminInterface
()
|
Instantiate a new instance of the Admin interface |
postBlockSignature
(block_sig)
|
Receive a block signature. |
postEnvelope
(envelope)
|
Receive an SCP envelope. |
shutdown
()
|
Calls the base class shutdown and store the latest SCP state
|
start
()
|
Begins asynchronous tasks for node discovery and periodic catchup. |
getBlock
(height)
|
|
getBlockHeaders
(heights)
|
|
getBlockHeight
()
|
|
getBlocksFrom
(height, max_blocks)
|
|
getConsensusParams
()
|
|
getEnrollment
(enroll_hash)
|
|
getLocalTime
()
|
GET /local_time |
getLocalTime
()
|
|
getMerklePath
(height, hash)
|
|
getNetworkManager
()
|
|
getNodeInfo
()
|
|
getPreimages
(enroll_keys)
|
|
getPreimagesFrom
(start_height)
|
|
getTaskManager
()
|
|
getTransactions
(tx_hashes)
|
|
getTransactions
(from)
|
|
getValidators
(height)
|
|
hasTransactionHash
(tx)
|
|
makeConsensusParams
(config)
|
Make a new instance of the consensus parameters based on the config |
postEnrollment
(enroll, avail_height)
|
POST /enrollment |
postPreimage
(preimage)
|
POST /preimage |
postTransaction
(tx)
|
Receive a transaction. |
acceptBlock
(block)
|
Store the block in the ledger if valid. |
acceptHeader
(header)
|
If block header is valid and after last paid height we add our signature in case missing and any other signatures we have in memory. Then the ledger is updated and the header is pushed to configured listeners. |
checkAndEnroll
(height)
|
Check if the next enrollment is available or validator is not enrolled. Enroll when necessary. |
discoveryTask
()
|
Begins asynchronous tasks for node discovery and periodic catchup. |
invalidNominationHandler
(_, msg)
|
A delegate to be called by Nominator when node's own nomination is invalid |
makeClock
()
|
Get a Clock instance. May be overriden in unittests to simulate clock disparities, as well as provide a custom median retrieveal delegate to simulate delays (task.wait() calls). |
makeLedger
()
|
Returns an instance of a ValidatingLedger .
|
makeLogger
()
|
|
makeNominator
(clock, network, ledger, enroll_man, taskman, block_catchup_timer)
|
Returns an instance of a Nominator. |
onAcceptedBlock
(block, validators_changed)
|
Calls the base class onAcceptedBlock and additionally
shuffles the quorum set if the new block header height
is QuorumShuffleInterval blocks newer than the last
shuffle height.
|
onPreImageRevealTimer
()
|
Periodically called to perform pre-images revelation. |
potentialExtraSigs
(header)
|
Count extra signatures that could be added to the provided header. |
preImageCatchupTask
()
|
Periodically retrieve pre-images if we are missing any. |
catchupTask
()
|
Periodically retrieve the latest blocks and apply them to the provided ledger. |
getDoubleSpentSelector
(txs)
|
Returns an instance of a DoubleSpentSelector |
makeBlockStorage
()
|
Returns an instance of an IBlockStorage
|
makeCacheDB
()
|
|
makeEnrollmentManager
()
|
Returns an instance of a EnrollmentManager |
makeLedger
()
|
Returns an instance of a Ledger to be used for a Fullnode .
|
makeNetworkManager
()
|
Returns an instance of a NetworkManager |
makeStateDB
()
|
|
makeTaskManager
()
|
Returns an instance of a TaskManager |
pushBlockHeader
(header)
|
Push an updated block header to the blockheader_handlers target server
list set in config.
The blockheader can have signatures from validators added even after the
block has been externalized.
|
pushPreImage
(pre_image)
|
Push the preimage to the preimage_handlers target server list
set in config.
|
pushTransaction
(tx)
|
Push the transaction to the transaction_handlers target server list
set in config.
|
recordReq
(endpoint, weight)
|
Convenience function to increase an endpoint stats |
Enums
Name | Description |
---|---|
TimersIdx
|