rippled
|
Represents a proposed position taken during a round of consensus. More...
Public Types | |
using | NodeID = NodeID_t |
Public Member Functions | |
ConsensusProposal (LedgerID_t const &prevLedger, std::uint32_t seq, Position_t const &position, NetClock::time_point closeTime, NetClock::time_point now, NodeID_t const &nodeID) | |
Constructor. More... | |
NodeID_t const & | nodeID () const |
Identifying which peer took this position. More... | |
Position_t const & | position () const |
Get the proposed position. More... | |
LedgerID_t const & | prevLedger () const |
Get the prior accepted ledger this position is based on. More... | |
std::uint32_t | proposeSeq () const |
Get the sequence number of this proposal. More... | |
NetClock::time_point const & | closeTime () const |
The current position on the consensus close time. More... | |
NetClock::time_point const & | seenTime () const |
Get when this position was taken. More... | |
bool | isInitial () const |
Whether this is the first position taken during the current consensus round. More... | |
bool | isBowOut () const |
Get whether this node left the consensus process. More... | |
bool | isStale (NetClock::time_point cutoff) const |
Get whether this position is stale relative to the provided cutoff. More... | |
void | changePosition (Position_t const &newPosition, NetClock::time_point newCloseTime, NetClock::time_point now) |
Update the position during the consensus process. More... | |
void | bowOut (NetClock::time_point now) |
Leave consensus. More... | |
Json::Value | getJson () const |
Get JSON representation for debugging. More... | |
uint256 const & | signingHash () const |
The digest for this proposal, used for signing purposes. More... | |
Static Public Attributes | |
static const std::uint32_t | seqJoin = 0 |
static const std::uint32_t | seqLeave = 0xffffffff |
Private Attributes | |
LedgerID_t | previousLedger_ |
Unique identifier of prior ledger this proposal is based on. More... | |
Position_t | position_ |
Unique identifier of the position this proposal is taking. More... | |
NetClock::time_point | closeTime_ |
The ledger close time this position is taking. More... | |
NetClock::time_point | time_ |
std::uint32_t | proposeSeq_ |
The sequence number of these positions taken by this node. More... | |
NodeID_t | nodeID_ |
The identifier of the node taking this position. More... | |
std::optional< uint256 > | signingHash_ |
The signing hash for this proposal. More... | |
Represents a proposed position taken during a round of consensus.
During consensus, peers seek agreement on a set of transactions to apply to the prior ledger to generate the next ledger. Each peer takes a position on whether to include or exclude potential transactions. The position on the set of transactions is proposed to its peers as an instance of the ConsensusProposal class.
An instance of ConsensusProposal can be either our own proposal or one of our peer's.
As consensus proceeds, peers may change their position on the transaction, or choose to abstain. Each successive proposal includes a strictly monotonically increasing number (or, if a peer is choosing to abstain, the special value seqLeave
).
Refer to Consensus for requirements of the template arguments.
NodeID_t | Type used to uniquely identify nodes/peers |
LedgerID_t | Type used to uniquely identify ledgers |
Position_t | Type used to represent the position taken on transactions under consideration during this round of consensus |
Definition at line 55 of file ConsensusProposal.h.
using ripple::ConsensusProposal< NodeID_t, LedgerID_t, Position_t >::NodeID = NodeID_t |
Definition at line 58 of file ConsensusProposal.h.
ripple::ConsensusProposal< NodeID_t, LedgerID_t, Position_t >::ConsensusProposal | ( | LedgerID_t const & | prevLedger, |
std::uint32_t | seq, | ||
Position_t const & | position, | ||
NetClock::time_point | closeTime, | ||
NetClock::time_point | now, | ||
NodeID_t const & | nodeID | ||
) |
Constructor.
prevLedger | The previous ledger this proposal is building on. |
seq | The sequence number of this proposal. |
position | The position taken on transactions in this round. |
closeTime | Position of when this ledger closed. |
now | Time when the proposal was taken. |
nodeID | ID of node/peer taking this position. |
Definition at line 75 of file ConsensusProposal.h.
NodeID_t const& ripple::ConsensusProposal< NodeID_t, LedgerID_t, Position_t >::nodeID | ( | ) | const |
Identifying which peer took this position.
Definition at line 93 of file ConsensusProposal.h.
Position_t const& ripple::ConsensusProposal< NodeID_t, LedgerID_t, Position_t >::position | ( | ) | const |
Get the proposed position.
Definition at line 100 of file ConsensusProposal.h.
LedgerID_t const& ripple::ConsensusProposal< NodeID_t, LedgerID_t, Position_t >::prevLedger | ( | ) | const |
Get the prior accepted ledger this position is based on.
Definition at line 107 of file ConsensusProposal.h.
std::uint32_t ripple::ConsensusProposal< NodeID_t, LedgerID_t, Position_t >::proposeSeq | ( | ) | const |
Get the sequence number of this proposal.
Starting with an initial sequence number of seqJoin
, successive proposals from a peer will increase the sequence number.
Definition at line 120 of file ConsensusProposal.h.
NetClock::time_point const& ripple::ConsensusProposal< NodeID_t, LedgerID_t, Position_t >::closeTime | ( | ) | const |
The current position on the consensus close time.
Definition at line 127 of file ConsensusProposal.h.
NetClock::time_point const& ripple::ConsensusProposal< NodeID_t, LedgerID_t, Position_t >::seenTime | ( | ) | const |
Get when this position was taken.
Definition at line 134 of file ConsensusProposal.h.
bool ripple::ConsensusProposal< NodeID_t, LedgerID_t, Position_t >::isInitial | ( | ) | const |
Whether this is the first position taken during the current consensus round.
Definition at line 143 of file ConsensusProposal.h.
bool ripple::ConsensusProposal< NodeID_t, LedgerID_t, Position_t >::isBowOut | ( | ) | const |
Get whether this node left the consensus process.
Definition at line 150 of file ConsensusProposal.h.
bool ripple::ConsensusProposal< NodeID_t, LedgerID_t, Position_t >::isStale | ( | NetClock::time_point | cutoff | ) | const |
Get whether this position is stale relative to the provided cutoff.
Definition at line 157 of file ConsensusProposal.h.
void ripple::ConsensusProposal< NodeID_t, LedgerID_t, Position_t >::changePosition | ( | Position_t const & | newPosition, |
NetClock::time_point | newCloseTime, | ||
NetClock::time_point | now | ||
) |
Update the position during the consensus process.
This will increment the proposal's sequence number if it has not already bowed out.
newPosition | The new position taken. |
newCloseTime | The new close time. |
now | the time The new position was taken |
Definition at line 170 of file ConsensusProposal.h.
void ripple::ConsensusProposal< NodeID_t, LedgerID_t, Position_t >::bowOut | ( | NetClock::time_point | now | ) |
Leave consensus.
Update position to indicate the node left consensus.
now | Time when this node left consensus. |
Definition at line 190 of file ConsensusProposal.h.
Json::Value ripple::ConsensusProposal< NodeID_t, LedgerID_t, Position_t >::getJson | ( | ) | const |
Get JSON representation for debugging.
Definition at line 199 of file ConsensusProposal.h.
uint256 const& ripple::ConsensusProposal< NodeID_t, LedgerID_t, Position_t >::signingHash | ( | ) | const |
The digest for this proposal, used for signing purposes.
Definition at line 220 of file ConsensusProposal.h.
|
static |
Definition at line 61 of file ConsensusProposal.h.
|
static |
Definition at line 64 of file ConsensusProposal.h.
|
private |
Unique identifier of prior ledger this proposal is based on.
Definition at line 237 of file ConsensusProposal.h.
|
private |
Unique identifier of the position this proposal is taking.
Definition at line 240 of file ConsensusProposal.h.
|
private |
The ledger close time this position is taking.
Definition at line 243 of file ConsensusProposal.h.
|
private |
Definition at line 246 of file ConsensusProposal.h.
|
private |
The sequence number of these positions taken by this node.
Definition at line 249 of file ConsensusProposal.h.
|
private |
The identifier of the node taking this position.
Definition at line 252 of file ConsensusProposal.h.
|
mutableprivate |
The signing hash for this proposal.
Definition at line 255 of file ConsensusProposal.h.