Class Nominator
class Nominator
: scpd .scp .SCPDriver .SCPDriver
;
Constructors
Name | Description |
---|---|
this
(params, key_pair, clock, network, ledger, enroll_man, taskman, catchup_timer, cacheDB, nomination_interval, externalize)
|
Constructor |
Fields
Name | Type | Description |
---|---|---|
acceptBlock
|
@safe string delegate(in ref Block) | Delegate called when a block is to be externalized |
enroll_man
|
EnrollmentManager | Enrollment manager |
onInvalidNomination
|
@safe void delegate(in ref ConsensusData, in string) | Delegate called when node's own nomination is invalid |
initial_missing_validators
|
uint[] | The missing validators at the start of the nomination round |
is_shutting_down
|
bool | Node is shutting down |
kp
|
KeyPair | Key pair of this node |
ledger
|
ValidatingLedger | Ledger instance |
log
|
Logger | Logger instance |
params
|
immutable(ConsensusParams) | Consensus parameters |
scp
|
scpd | SCP instance |
store
|
SCPEnvelopeStore | SCPEnvelopeStore instance |
timers
|
ITimer[3] | Timers this node has started not including the SCP slot timers |
Methods
Name | Description |
---|---|
combineCandidates
(slot_idx, candidates)
|
Combine a set of transaction sets into a single transaction set. This may be done in arbitrary ways, as long as it's consistent (for a given input, the combined output is predictable). Please see CandidateHolder.opCmp for the actual implementation of which candidate is chosen. |
emitEnvelope
(envelope)
|
Floods the given SCPEnvelope to the network of connected peers. |
getNodeUTXO
(slot_index, index)
|
Get the UTXO hash for the index of the validator at a height |
getQSet
(node_id)
|
|
potentialExtraSigs
(header)
|
Count how many block signatures could be added from memory |
receiveBlockSignature
(block_sig)
|
Called when a new Block Signature is received from the network. |
receiveEnvelope
(envelope)
|
Called when a new SCP Envelope is received from the network. It queues it up for processing by the envelope process fiber. |
resetPendingBlock
(height)
|
Reset the pending block and arm the timers at defaults again |
selfSignBlock
(header)
|
Sign the block and add it to the given block header |
setQuorumConfig
(node_id, quorums)
|
Update our quorum configuration and store the mapping of all quorums for lookup in getQSet(). |
setupTimer
(slot_idx, timer_type, timeout, callback)
|
Used for setting and clearing C++ callbacks which fire after a given timeout. |
shutdown
()
|
Shut down the timers |
signEnvelope
(envelope)
|
Signs the SCPEnvelope with the node's private key. |
start
()
|
Start nominating. |
stopNominatingTimer
()
|
Stops nominating. |
stopNominationRound
(height)
|
Stop the nominating round. Should be called after a block is accepted to the ledger. |
storeLatestState
()
|
Store the latest SCP state and the queued SCP envelopes, for restoring later. |
updateMultiSignature
(header)
|
Add missing block signatures to provided block header if known |
updateSCPObject
(node_id)
|
Create or update Stellar SCP object |
validateValue
(slot_idx, value, nomination)
|
Validates the provided transaction set for the provided slot index, and returns a status code of the validation. |
valueExternalized
(slot_idx, value)
|
Called when consenus has been reached for the provided slot index and the transaction set. If successful this node's block signature is gossiped to the network in case missing from other nodes. |
checkExternalize
()
|
If we have majority signatures then externalize to the ledger otherwise check again after receiving signatures |
checkNominate
()
|
The main nominating function. |
computeTimeout
(roundNumber)
|
computeTimeout computes a timeout given a round number
it should be sufficiently large such that nodes in a
quorum can exchange 4 messages
|
gossipBlockSignature
(block_sig)
|
function for gossip of block sig which can be overriden in byzantine unit tests |
nominate
(slot_idx, next)
|
Nominate a new data set to the quorum. Failure to nominate is only logged. |
prepareNominatingSet
(data)
|
Check whether we're ready to nominate a new block. |
restoreSCPState
()
|
Restore SCP's internal state based on the stored latest envelopes |
scoreCandidate
(data)
|
Calculate a score for the given candidate |
signBlock
(header)
|
Sign this block using our private key / pre-image. |
verifyBlock
(signed_block)
|
function for verifying the block which can be overriden in byzantine unit tests |
Inner structs
Name | Description |
---|---|
CandidateHolder
|
holds candidate and it's score |
CandidateScore
|
Used for comparing consensus candidate values. It contains precomputed fields to speed up sorting. |
Enums
Name | Description |
---|---|
TimersIdx
|