rippled
Loading...
Searching...
No Matches
Classes | Public Member Functions | Private Attributes | Static Private Attributes | List of all members
xrpl::RCLConsensus Class Reference

Manages the generic consensus algorithm for use by the RCL. More...

#include <RCLConsensus.h>

Collaboration diagram for xrpl::RCLConsensus:
Collaboration graph
[legend]

Classes

class  Adaptor
 

Public Member Functions

 RCLConsensus (Application &app, std::unique_ptr< FeeVote > &&feeVote, LedgerMaster &ledgerMaster, LocalTxs &localTxs, InboundTransactions &inboundTransactions, Consensus< Adaptor >::clock_type const &clock, ValidatorKeys const &validatorKeys, beast::Journal journal)
 Constructor.
 
 RCLConsensus (RCLConsensus const &)=delete
 
RCLConsensusoperator= (RCLConsensus const &)=delete
 
bool validating () const
 Whether we are validating consensus ledgers.
 
std::size_t prevProposers () const
 Get the number of proposing peers that participated in the previous round.
 
std::chrono::milliseconds prevRoundTime () const
 Get duration of the previous round.
 
ConsensusMode mode () const
 
ConsensusPhase phase () const
 
Json::Value getJson (bool full) const
 
void startRound (NetClock::time_point const &now, RCLCxLedger::ID const &prevLgrId, RCLCxLedger const &prevLgr, hash_set< NodeID > const &nowUntrusted, hash_set< NodeID > const &nowTrusted, std::unique_ptr< std::stringstream > const &clog)
 Adjust the set of trusted validators and kick-off the next round of consensus.
 
void timerEntry (NetClock::time_point const &now, std::unique_ptr< std::stringstream > const &clog={})
 
void gotTxSet (NetClock::time_point const &now, RCLTxSet const &txSet)
 
RCLCxLedger::ID prevLedgerID () const
 
void simulate (NetClock::time_point const &now, std::optional< std::chrono::milliseconds > consensusDelay)
 
bool peerProposal (NetClock::time_point const &now, RCLCxPeerPos const &newProposal)
 
ConsensusParms const & parms () const
 

Private Attributes

std::recursive_mutex mutex_
 
Adaptor adaptor_
 
Consensus< Adaptorconsensus_
 
beast::Journal const j_
 

Static Private Attributes

static constexpr unsigned int censorshipWarnInternal = 15
 Warn for transactions that haven't been included every so many ledgers.
 

Detailed Description

Manages the generic consensus algorithm for use by the RCL.

Definition at line 32 of file RCLConsensus.h.

Constructor & Destructor Documentation

◆ RCLConsensus() [1/2]

xrpl::RCLConsensus::RCLConsensus ( Application app,
std::unique_ptr< FeeVote > &&  feeVote,
LedgerMaster ledgerMaster,
LocalTxs localTxs,
InboundTransactions inboundTransactions,
Consensus< Adaptor >::clock_type const &  clock,
ValidatorKeys const &  validatorKeys,
beast::Journal  journal 
)

Constructor.

Definition at line 35 of file RCLConsensus.cpp.

◆ RCLConsensus() [2/2]

xrpl::RCLConsensus::RCLConsensus ( RCLConsensus const &  )
delete

Member Function Documentation

◆ operator=()

RCLConsensus & xrpl::RCLConsensus::operator= ( RCLConsensus const &  )
delete

◆ validating()

bool xrpl::RCLConsensus::validating ( ) const

Whether we are validating consensus ledgers.

Definition at line 403 of file RCLConsensus.h.

◆ prevProposers()

std::size_t xrpl::RCLConsensus::prevProposers ( ) const

Get the number of proposing peers that participated in the previous round.

Definition at line 411 of file RCLConsensus.h.

◆ prevRoundTime()

std::chrono::milliseconds xrpl::RCLConsensus::prevRoundTime ( ) const

Get duration of the previous round.

The duration of the round is the establish phase, measured from closing the open ledger to accepting the consensus result.

Returns
Last round duration in milliseconds

Definition at line 424 of file RCLConsensus.h.

◆ mode()

ConsensusMode xrpl::RCLConsensus::mode ( ) const
See also
Consensus::mode

Definition at line 431 of file RCLConsensus.h.

◆ phase()

ConsensusPhase xrpl::RCLConsensus::phase ( ) const

Definition at line 437 of file RCLConsensus.h.

◆ getJson()

Json::Value xrpl::RCLConsensus::getJson ( bool  full) const
See also
Consensus::getJson

Definition at line 781 of file RCLConsensus.cpp.

◆ startRound()

void xrpl::RCLConsensus::startRound ( NetClock::time_point const &  now,
RCLCxLedger::ID const &  prevLgrId,
RCLCxLedger const &  prevLgr,
hash_set< NodeID > const &  nowUntrusted,
hash_set< NodeID > const &  nowTrusted,
std::unique_ptr< std::stringstream > const &  clog 
)

Adjust the set of trusted validators and kick-off the next round of consensus.

For more details,

See also
Consensus::startRound

Definition at line 925 of file RCLConsensus.cpp.

◆ timerEntry()

void xrpl::RCLConsensus::timerEntry ( NetClock::time_point const &  now,
std::unique_ptr< std::stringstream > const &  clog = {} 
)
See also
Consensus::timerEntry

Definition at line 793 of file RCLConsensus.cpp.

◆ gotTxSet()

void xrpl::RCLConsensus::gotTxSet ( NetClock::time_point const &  now,
RCLTxSet const &  txSet 
)
See also
Consensus::gotTxSet

Definition at line 812 of file RCLConsensus.cpp.

◆ prevLedgerID()

RCLCxLedger::ID xrpl::RCLConsensus::prevLedgerID ( ) const

Definition at line 468 of file RCLConsensus.h.

◆ simulate()

void xrpl::RCLConsensus::simulate ( NetClock::time_point const &  now,
std::optional< std::chrono::milliseconds consensusDelay 
)
See also
Consensus::simulate

Definition at line 830 of file RCLConsensus.cpp.

◆ peerProposal()

bool xrpl::RCLConsensus::peerProposal ( NetClock::time_point const &  now,
RCLCxPeerPos const &  newProposal 
)
See also
Consensus::proposal

Definition at line 837 of file RCLConsensus.cpp.

◆ parms()

ConsensusParms const & xrpl::RCLConsensus::parms ( ) const

Definition at line 483 of file RCLConsensus.h.

Member Data Documentation

◆ censorshipWarnInternal

constexpr unsigned int xrpl::RCLConsensus::censorshipWarnInternal = 15
staticconstexprprivate

Warn for transactions that haven't been included every so many ledgers.

Definition at line 36 of file RCLConsensus.h.

◆ mutex_

std::recursive_mutex xrpl::RCLConsensus::mutex_
mutableprivate

Definition at line 492 of file RCLConsensus.h.

◆ adaptor_

Adaptor xrpl::RCLConsensus::adaptor_
private

Definition at line 494 of file RCLConsensus.h.

◆ consensus_

Consensus<Adaptor> xrpl::RCLConsensus::consensus_
private

Definition at line 495 of file RCLConsensus.h.

◆ j_

beast::Journal const xrpl::RCLConsensus::j_
private

Definition at line 496 of file RCLConsensus.h.