Class NodeLedger

The Ledger class held by a node

class NodeLedger
  : Ledger ;

Constructors

NameDescription
this (params, database, storage, enroll_man, pool, onAcceptedBlock) Constructor

Fields

NameTypeDescription
sig_missing_heights Set!(ulong)Keep track of missing signatures since last paid out block in a set
params immutable(ConsensusParams)Consensus-critical constants used by this Ledger
enroll_man EnrollmentManagerEnrollment manager
frozen_utxos UTXOTrackerThe list of frozen UTXOs known to this Ledger
onAcceptedBlock @safe void delegate(in ref Block, bool)A delegate to be called when a block was externalized (unless null)
pool TransactionPoolPool of transactions to pick from when generating blocks
unknown_txs Set!(geod24.bitblob.BitBlob!(64L).BitBlob)Hashes of transactions the Ledger encountered but doesn't have in the pool
cached_coinbase Ledger.CachedCoinbaseCache for Coinbase tx to be used during payout height
engine EngineScript execution engine
fee_man FeeManagerThe checker of transaction data payload
last_block BlockThe last block in the ledger
log LoggerLogger instance
rewards RewardBlock rewards calculator
stateDB ManagedDatabaseThe database in which the Ledger state is stored
storage IBlockStoragedata storage for all the blocks
utxo_set UTXOCacheUTXO set
validator_set ValidatorSetThe object controlling the validator set

Methods

NameDescription
acceptBlock (block) See Ledger.acceptBlock
acceptTransaction (tx, double_spent_threshold_pct, min_fee_pct) Called when a new transaction is received.
getCandidateEnrollments (height, utxo_finder)
getDoubleSpentHighestFee (tx) Returns the highest fee among all the transactions which would be considered as a double spent, if tx transaction was in the transaction pool.
getStakes () Get a set of all the stakes currently active at this height
getTransactionByHash (hash) Get a transaction from pool by hash
getTxFeeRate (tx, rate) Forwards to FeeManager.getTxFeeRate, using this Ledger's UTXO.
getTxFeeRate (tx_hash, rate) Looks up transaction with hash tx_hash, then forwards to FeeManager.getTxFeeRate, using this Ledger's UTXO.
getUnknownTXHashes () Get a set of TX Hashes that Ledger is missing
getUnknownTXsFromSet (hashes)
isAcceptableDoubleSpent (tx, threshold_pct) Checks whether the tx is an acceptable double spend transaction.
addPreimage (preimage) Add a pre-image information to the validator data
buildBlock (txs, enrollments, missing_validators) Create a new block based on the current previous block.
expectedHeight (utcTime) Get the Height this Ledger should be at if fully synchronized
getBlocks (rng) Get a range of blocks, starting from the provided block height.
getBlocksFrom (start) Get a range of blocks from start to Ledger.height
getEnrolledUTXOs (height)
getExpectedBlockTime (height) Gets the expected block nomination time offset from Genesis start time.
getLastPaidHeight () return the last paid out block before the current block
getPenaltyDeposit (utxo)
getUTXOFinder () Prepare tracking double-spent transactions and return the UTXOFinder delegate
getValidators (height, empty) Expose the list of validators at a given height
hasMajoritySignature (header)
height () Returns the height at which this Ledger is currently at
isCoinbaseBlock (height) Check if this is the height for payouts of a payout period
isRelatedRewardBlock (reward_height, coinbase_height) Check if block is related to given payout block
isStake (hash, utxo)
lastBlock () Returns a reference to the last block in the Ledger
peekUTXO (utxo, value) Get an UTXO, no double-spend protection.
updateBlockMultiSig (header) Update the Schnorr multi-signature for an externalized block in the Ledger.
utxos () Expose an object that interacts with the UTXO set
validateBlock (block) Check whether the block is valid.
validateBlockSignature (header) Validate the signature of a block
validatorCount (height) Get the count of active validators at a given height.
addValidatedBlock (block) See Ledger.addValidatedBlock`
updateUTXOSet (block) See Ledger.updateUTXOSet
updateValidatorSet (block) See Ledger.updateValidatorSet
applySlashing (header) Apply slashing to the current state
getCoinbaseTX (height) Create the Coinbase transaction for this payout block and append it to the transaction set
handleNotSignedByMajority (header, validators) Used to handle behaviour when less than half the validators have signed the block. This is overridden in the ValidatingLedger
replayStoredBlock (block) Update the ledger state from a block which was read from storage

Inner structs

NameDescription
CachedCoinbase Cache for Coinbase tx to be used during payout height

Enums

NameDescription
InvalidConsensusDataReason Error message describing the reason of validation failure