Class NodeLedger
The Ledger class held by a node
Constructors
Name | Description |
---|---|
this
(params, database, storage, enroll_man, pool, onAcceptedBlock)
|
Constructor |
Fields
Name | Type | Description |
---|---|---|
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
|
EnrollmentManager | Enrollment manager |
frozen_utxos
|
UTXOTracker | The 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
|
TransactionPool | Pool 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 | Cache for Coinbase tx to be used during payout height |
engine
|
Engine | Script execution engine |
fee_man
|
FeeManager | The checker of transaction data payload |
last_block
|
Block | The last block in the ledger |
log
|
Logger | Logger instance |
rewards
|
Reward | Block rewards calculator |
stateDB
|
ManagedDatabase | The database in which the Ledger state is stored |
storage
|
IBlockStorage | data storage for all the blocks |
utxo_set
|
UTXOCache | UTXO set |
validator_set
|
ValidatorSet | The object controlling the validator set |
Methods
Name | Description |
---|---|
acceptBlock
(block)
|
See Ledger
|
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 , using this Ledger's UTXO.
|
getTxFeeRate
(tx_hash, rate)
|
Looks up transaction with hash tx_hash , then forwards to
FeeManager , 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
|
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
|
updateValidatorSet
(block)
|
See Ledger
|
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
Name | Description |
---|---|
CachedCoinbase
|
Cache for Coinbase tx to be used during payout height |
Enums
Name | Description |
---|---|
InvalidConsensusDataReason
|
Error message describing the reason of validation failure |