rippled
|
Public Types | |
using | Ledger_t = RCLCxLedger |
using | NodeID_t = NodeID |
using | NodeKey_t = PublicKey |
using | TxSet_t = RCLTxSet |
using | PeerPosition_t = RCLCxPeerPos |
using | Result = ConsensusResult< Adaptor > |
Public Member Functions | |
Adaptor (Application &app, std::unique_ptr< FeeVote > &&feeVote, LedgerMaster &ledgerMaster, LocalTxs &localTxs, InboundTransactions &inboundTransactions, ValidatorKeys const &validatorKeys, beast::Journal journal) | |
bool | validating () const |
std::size_t | prevProposers () const |
std::chrono::milliseconds | prevRoundTime () const |
ConsensusMode | mode () const |
bool | preStartRound (RCLCxLedger const &prevLedger, hash_set< NodeID > const &nowTrusted) |
Called before kicking off a new consensus round. More... | |
bool | haveValidated () const |
LedgerIndex | getValidLedgerIndex () const |
std::pair< std::size_t, hash_set< NodeKey_t > > | getQuorumKeys () const |
std::size_t | laggards (Ledger_t::Seq const seq, hash_set< NodeKey_t > &trustedKeys) const |
bool | validator () const |
Whether I am a validator. More... | |
void | updateOperatingMode (std::size_t const positions) const |
Update operating mode based on current peer positions. More... | |
ConsensusParms const & | parms () const |
Consensus simulation parameters. More... | |
Private Member Functions | |
std::optional< RCLCxLedger > | acquireLedger (LedgerHash const &hash) |
Attempt to acquire a specific ledger. More... | |
void | share (RCLCxPeerPos const &peerPos) |
Share the given proposal with all peers. More... | |
void | share (RCLCxTx const &tx) |
Share disputed transaction to peers. More... | |
std::optional< RCLTxSet > | acquireTxSet (RCLTxSet::ID const &setId) |
Acquire the transaction set associated with a proposal. More... | |
bool | hasOpenTransactions () const |
Whether the open ledger has any transactions. More... | |
std::size_t | proposersValidated (LedgerHash const &h) const |
Number of proposers that have validated the given ledger. More... | |
std::size_t | proposersFinished (RCLCxLedger const &ledger, LedgerHash const &h) const |
Number of proposers that have validated a ledger descended from requested ledger. More... | |
void | propose (RCLCxPeerPos::Proposal const &proposal) |
Propose the given position to my peers. More... | |
void | share (RCLTxSet const &txns) |
Share the given tx set to peers. More... | |
uint256 | getPrevLedger (uint256 ledgerID, RCLCxLedger const &ledger, ConsensusMode mode) |
Get the ID of the previous ledger/last closed ledger(LCL) on the network. More... | |
void | onModeChange (ConsensusMode before, ConsensusMode after) |
Notified of change in consensus mode. More... | |
Result | onClose (RCLCxLedger const &ledger, NetClock::time_point const &closeTime, ConsensusMode mode) |
Close the open ledger and return initial consensus position. More... | |
void | onAccept (Result const &result, RCLCxLedger const &prevLedger, NetClock::duration const &closeResolution, ConsensusCloseTimes const &rawCloseTimes, ConsensusMode const &mode, Json::Value &&consensusJson) |
Process the accepted ledger. More... | |
void | onForceAccept (Result const &result, RCLCxLedger const &prevLedger, NetClock::duration const &closeResolution, ConsensusCloseTimes const &rawCloseTimes, ConsensusMode const &mode, Json::Value &&consensusJson) |
Process the accepted ledger that was a result of simulation/force accept. More... | |
void | notify (protocol::NodeEvent ne, RCLCxLedger const &ledger, bool haveCorrectLCL) |
Notify peers of a consensus state change. More... | |
void | doAccept (Result const &result, RCLCxLedger const &prevLedger, NetClock::duration closeResolution, ConsensusCloseTimes const &rawCloseTimes, ConsensusMode const &mode, Json::Value &&consensusJson) |
Accept a new ledger based on the given transactions. More... | |
RCLCxLedger | buildLCL (RCLCxLedger const &previousLedger, CanonicalTXSet &retriableTxs, NetClock::time_point closeTime, bool closeTimeCorrect, NetClock::duration closeResolution, std::chrono::milliseconds roundTime, std::set< TxID > &failedTxs) |
Build the new last closed ledger. More... | |
void | validate (RCLCxLedger const &ledger, RCLTxSet const &txns, bool proposing) |
Validate the given ledger and share with peers as necessary. More... | |
Friends | |
class | Consensus< Adaptor > |
Definition at line 57 of file RCLConsensus.h.
Definition at line 91 of file RCLConsensus.h.
Definition at line 92 of file RCLConsensus.h.
Definition at line 93 of file RCLConsensus.h.
Definition at line 94 of file RCLConsensus.h.
Definition at line 95 of file RCLConsensus.h.
Definition at line 97 of file RCLConsensus.h.
ripple::RCLConsensus::Adaptor::Adaptor | ( | Application & | app, |
std::unique_ptr< FeeVote > && | feeVote, | ||
LedgerMaster & | ledgerMaster, | ||
LocalTxs & | localTxs, | ||
InboundTransactions & | inboundTransactions, | ||
ValidatorKeys const & | validatorKeys, | ||
beast::Journal | journal | ||
) |
Definition at line 74 of file RCLConsensus.cpp.
bool ripple::RCLConsensus::Adaptor::validating | ( | ) | const |
Definition at line 109 of file RCLConsensus.h.
std::size_t ripple::RCLConsensus::Adaptor::prevProposers | ( | ) | const |
Definition at line 115 of file RCLConsensus.h.
std::chrono::milliseconds ripple::RCLConsensus::Adaptor::prevRoundTime | ( | ) | const |
Definition at line 121 of file RCLConsensus.h.
ConsensusMode ripple::RCLConsensus::Adaptor::mode | ( | ) | const |
Definition at line 127 of file RCLConsensus.h.
bool ripple::RCLConsensus::Adaptor::preStartRound | ( | RCLCxLedger const & | prevLedger, |
hash_set< NodeID > const & | nowTrusted | ||
) |
Called before kicking off a new consensus round.
prevLedger | Ledger that will be prior ledger for next round |
nowTrusted | the new validators |
Definition at line 957 of file RCLConsensus.cpp.
bool ripple::RCLConsensus::Adaptor::haveValidated | ( | ) | const |
Definition at line 1008 of file RCLConsensus.cpp.
LedgerIndex ripple::RCLConsensus::Adaptor::getValidLedgerIndex | ( | ) | const |
Definition at line 1014 of file RCLConsensus.cpp.
std::pair< std::size_t, hash_set< RCLConsensus::Adaptor::NodeKey_t > > ripple::RCLConsensus::Adaptor::getQuorumKeys | ( | ) | const |
Definition at line 1020 of file RCLConsensus.cpp.
std::size_t ripple::RCLConsensus::Adaptor::laggards | ( | Ledger_t::Seq const | seq, |
hash_set< NodeKey_t > & | trustedKeys | ||
) | const |
Definition at line 1026 of file RCLConsensus.cpp.
bool ripple::RCLConsensus::Adaptor::validator | ( | ) | const |
Whether I am a validator.
Definition at line 1034 of file RCLConsensus.cpp.
void ripple::RCLConsensus::Adaptor::updateOperatingMode | ( | std::size_t const | positions | ) | const |
Update operating mode based on current peer positions.
If our current ledger has no agreement from the network, then we cannot be in the omFULL mode.
positions | Number of current peer positions. |
Definition at line 1040 of file RCLConsensus.cpp.
ConsensusParms const& ripple::RCLConsensus::Adaptor::parms | ( | ) | const |
Consensus simulation parameters.
Definition at line 176 of file RCLConsensus.h.
|
private |
Attempt to acquire a specific ledger.
If not available, asynchronously acquires from the network.
hash | The ID/hash of the ledger acquire |
Definition at line 121 of file RCLConsensus.cpp.
|
private |
Share the given proposal with all peers.
peerPos | The peer position to share. |
Definition at line 154 of file RCLConsensus.cpp.
|
private |
Share disputed transaction to peers.
Only share if the provided transaction hasn't been shared recently.
tx | The disputed transaction to share. |
Definition at line 178 of file RCLConsensus.cpp.
|
private |
Acquire the transaction set associated with a proposal.
If the transaction set is not available locally, will attempt acquire it from the network.
setId | The transaction set ID associated with the proposal |
Definition at line 243 of file RCLConsensus.cpp.
|
private |
Whether the open ledger has any transactions.
Definition at line 253 of file RCLConsensus.cpp.
|
private |
Number of proposers that have validated the given ledger.
h | The hash of the ledger of interest |
Definition at line 259 of file RCLConsensus.cpp.
|
private |
Number of proposers that have validated a ledger descended from requested ledger.
ledger | The current working ledger |
h | The hash of the preferred working ledger |
Definition at line 265 of file RCLConsensus.cpp.
|
private |
Propose the given position to my peers.
proposal | Our proposed position |
Definition at line 199 of file RCLConsensus.cpp.
|
private |
Share the given tx set to peers.
txns | The TxSet to share. |
Definition at line 237 of file RCLConsensus.cpp.
|
private |
Get the ID of the previous ledger/last closed ledger(LCL) on the network.
ledgerID | ID of previous ledger used by consensus |
ledger | Previous ledger consensus has available |
mode | Current consensus mode |
Definition at line 275 of file RCLConsensus.cpp.
|
private |
Notified of change in consensus mode.
before | The prior consensus mode |
after | The new consensus mode |
Definition at line 877 of file RCLConsensus.cpp.
|
private |
Close the open ledger and return initial consensus position.
ledger | the ledger we are changing to |
closeTime | When consensus closed the ledger |
mode | Current consensus mode |
Definition at line 297 of file RCLConsensus.cpp.
|
private |
Process the accepted ledger.
result | The result of consensus |
prevLedger | The closed ledger consensus worked from |
closeResolution | The resolution used in agreeing on an effective closeTime |
rawCloseTimes | The unrounded closetimes of ourself and our peers |
mode | Our participating mode at the time consensus was declared |
consensusJson | Json representation of consensus state |
Definition at line 413 of file RCLConsensus.cpp.
|
private |
Process the accepted ledger that was a result of simulation/force accept.
Definition at line 395 of file RCLConsensus.cpp.
|
private |
Notify peers of a consensus state change.
ne | Event type for notification |
ledger | The ledger at the time of the state change |
haveCorrectLCL | Whether we believe we have the correct LCL. |
Definition at line 710 of file RCLConsensus.cpp.
|
private |
Accept a new ledger based on the given transactions.
Definition at line 442 of file RCLConsensus.cpp.
|
private |
Build the new last closed ledger.
Accept the given the provided set of consensus transactions and build the last closed ledger. Since consensus just agrees on which transactions to apply, but not whether they make it into the closed ledger, this function also populates retriableTxs with those that can be retried in the next round.
previousLedger | Prior ledger building upon |
retriableTxs | On entry, the set of transactions to apply to the ledger; on return, the set of transactions to retry in the next round. |
closeTime | The time the ledger closed |
closeTimeCorrect | Whether consensus agreed on close time |
closeResolution | Resolution used to determine consensus close time |
roundTime | Duration of this consensus round |
failedTxs | Populate with transactions that we could not successfully apply. |
Definition at line 749 of file RCLConsensus.cpp.
|
private |
Validate the given ledger and share with peers as necessary.
ledger | The ledger to validate |
txns | The consensus transaction set |
proposing | Whether we were proposing transactions while generating this ledger. If we are not proposing, a validation can still be sent to inform peers that we know we aren't fully participating in consensus but are still around and trying to catch up. |
Definition at line 790 of file RCLConsensus.cpp.
Definition at line 193 of file RCLConsensus.h.
|
private |
Definition at line 59 of file RCLConsensus.h.
|
private |
Definition at line 60 of file RCLConsensus.h.
|
private |
Definition at line 61 of file RCLConsensus.h.
|
private |
Definition at line 62 of file RCLConsensus.h.
|
private |
Definition at line 63 of file RCLConsensus.h.
|
private |
Definition at line 64 of file RCLConsensus.h.
|
private |
Definition at line 67 of file RCLConsensus.h.
|
private |
Definition at line 70 of file RCLConsensus.h.
|
private |
Definition at line 73 of file RCLConsensus.h.
|
private |
Definition at line 74 of file RCLConsensus.h.
|
private |
Definition at line 77 of file RCLConsensus.h.
|
private |
Definition at line 81 of file RCLConsensus.h.
|
private |
Definition at line 82 of file RCLConsensus.h.
|
private |
Definition at line 83 of file RCLConsensus.h.
|
private |
Definition at line 85 of file RCLConsensus.h.
|
private |
Definition at line 87 of file RCLConsensus.h.
|
private |
Definition at line 88 of file RCLConsensus.h.