| 
    rippled
    
   | 
 
A single peer in the simulation. More...
#include <Peer.h>

Classes | |
| struct | BroadcastMesg | 
| class | Position | 
| Basic wrapper of a proposed position taken by a peer.  More... | |
| struct | ProcessingDelays | 
| Simulated delays in internal peer processing.  More... | |
| struct | Router | 
| class | TestConsensusLogger | 
| class | ValAdaptor | 
| Generic Validations adaptor that simply ignores recently stale validations.  More... | |
Public Types | |
| using | Ledger_t = Ledger | 
| Type definitions for generic consensus.   | |
| using | NodeID_t = PeerID | 
| using | NodeKey_t = PeerKey | 
| using | TxSet_t = TxSet | 
| using | PeerPosition_t = Position | 
| using | Result = ConsensusResult< Peer > | 
| using | NodeKey = Validation::NodeKey | 
Public Member Functions | |
| Peer (PeerID i, Scheduler &s, LedgerOracle &o, BasicNetwork< Peer * > &n, TrustGraph< Peer * > &tg, CollectorRefs &c, beast::Journal jIn) | |
| Constructor.   | |
| template<class T > | |
| void | schedule (std::chrono::nanoseconds when, T &&what) | 
Schedule the provided callback in when duration, but if when is 0, call immediately.   | |
| template<class E > | |
| void | issue (E const &event) | 
| void | trust (Peer &o) | 
| void | untrust (Peer &o) | 
| bool | trusts (Peer &o) | 
| bool | trusts (PeerID const &oId) | 
| bool | connect (Peer &o, SimDuration dur) | 
| Create network connection.   | |
| bool | disconnect (Peer &o) | 
| Remove a network connection.   | |
| Ledger const * | acquireLedger (Ledger::ID const &ledgerID) | 
| TxSet const * | acquireTxSet (TxSet::ID const &setId) | 
| bool | hasOpenTransactions () const | 
| std::size_t | proposersValidated (Ledger::ID const &prevLedger) | 
| std::size_t | proposersFinished (Ledger const &prevLedger, Ledger::ID const &prevLedgerID) | 
| Result | onClose (Ledger const &prevLedger, NetClock::time_point closeTime, ConsensusMode mode) | 
| void | onForceAccept (Result const &result, Ledger const &prevLedger, NetClock::duration const &closeResolution, ConsensusCloseTimes const &rawCloseTimes, ConsensusMode const &mode, Json::Value &&consensusJson) | 
| void | onAccept (Result const &result, Ledger const &prevLedger, NetClock::duration const &closeResolution, ConsensusCloseTimes const &rawCloseTimes, ConsensusMode const &mode, Json::Value &&consensusJson, bool const validating) | 
| Ledger::Seq | earliestAllowedSeq () const | 
| Ledger::ID | getPrevLedger (Ledger::ID const &ledgerID, Ledger const &ledger, ConsensusMode mode) | 
| void | propose (Proposal const &pos) | 
| ConsensusParms const & | parms () const | 
| void | onModeChange (ConsensusMode, ConsensusMode) | 
| template<class M > | |
| void | share (M const &m) | 
| void | share (Position const &p) | 
| bool | addTrustedValidation (Validation v) | 
| Add a trusted validation and return true if it is worth forwarding.   | |
| void | checkFullyValidated (Ledger const &ledger) | 
| Check if a new ledger can be deemed fully validated.   | |
| template<class M > | |
| void | send (BroadcastMesg< M > const &bm, PeerID from) | 
| template<class M > | |
| void | receive (BroadcastMesg< M > const &bm, PeerID from) | 
| bool | handle (Proposal const &p) | 
| bool | handle (TxSet const &txs) | 
| bool | handle (Tx const &tx) | 
| bool | handle (Validation const &v) | 
| bool | haveValidated () const | 
| Ledger::Seq | getValidLedgerIndex () const | 
| std::pair< std::size_t, hash_set< NodeKey_t > > | getQuorumKeys () | 
| std::size_t | laggards (Ledger::Seq const seq, hash_set< NodeKey_t > &trusted) | 
| bool | validator () const | 
| void | updateOperatingMode (std::size_t const positions) const | 
| bool | validating () const | 
| void | submit (Tx const &tx) | 
| void | timerEntry () | 
| Heartbeat timer call.   | |
| void | startRound () | 
| void | start () | 
| NetClock::time_point | now () const | 
| Ledger::ID | prevLedgerID () const | 
| TxSet | injectTxs (Ledger prevLedger, TxSet const &src) | 
| Inject non-consensus Tx.   | |
Public Attributes | |
| beast::WrappedSink | sink | 
| Logging support that prefixes messages with the peer ID.   | |
| beast::Journal | j | 
| Consensus< Peer > | consensus | 
| Generic consensus.   | |
| PeerID | id | 
| Our unique ID.   | |
| PeerKey | key | 
| Current signing key.   | |
| LedgerOracle & | oracle | 
| The oracle that manages unique ledgers.   | |
| Scheduler & | scheduler | 
| Scheduler of events.   | |
| BasicNetwork< Peer * > & | net | 
| Handle to network for sending messages.   | |
| TrustGraph< Peer * > & | trustGraph | 
| Handle to Trust graph of network.   | |
| TxSetType | openTxs | 
| openTxs that haven't been closed in a ledger yet   | |
| Ledger | lastClosedLedger | 
| The last ledger closed by this node.   | |
| hash_map< Ledger::ID, Ledger > | ledgers | 
| Ledgers this node has closed or loaded from the network.   | |
| Validations< ValAdaptor > | validations | 
| Validations from trusted nodes.   | |
| Ledger | fullyValidatedLedger | 
| The most recent ledger that has been fully validated by the network from the perspective of this Peer.   | |
| bc::flat_map< Ledger::ID, std::vector< Proposal > > | peerPositions | 
| Map from Ledger::ID to vector of Positions with that ledger as the prior ledger.   | |
| bc::flat_map< TxSet::ID, TxSet > | txSets | 
| TxSet associated with a TxSet::ID.   | |
| bc::flat_map< Ledger::ID, SimTime > | acquiringLedgers | 
| bc::flat_map< TxSet::ID, SimTime > | acquiringTxSets | 
| int | completedLedgers = 0 | 
| The number of ledgers this peer has completed.   | |
| int | targetLedgers = std::numeric_limits<int>::max() | 
| The number of ledgers this peer should complete before stopping to run.   | |
| std::chrono::seconds | clockSkew {0} | 
| Skew of time relative to the common scheduler clock.   | |
| ProcessingDelays | delays | 
| Simulated delays to use for internal processing.   | |
| bool | runAsValidator = true | 
| Whether to simulate running as validator or a tracking node.   | |
| std::size_t | prevProposers = 0 | 
| std::chrono::milliseconds | prevRoundTime | 
| std::size_t | quorum = 0 | 
| hash_set< NodeKey_t > | trustedKeys | 
| ConsensusParms | consensusParms | 
| CollectorRefs & | collectors | 
| The collectors to report events to.   | |
| Router | router | 
| hash_map< Ledger::Seq, Tx > | txInjections | 
A single peer in the simulation.
This is the main work-horse of the consensus simulation framework and is where many other components are integrated. The peer
Definition at line 40 of file test/csf/Peer.h.
Type definitions for generic consensus.
Definition at line 153 of file test/csf/Peer.h.
Definition at line 154 of file test/csf/Peer.h.
Definition at line 155 of file test/csf/Peer.h.
Definition at line 156 of file test/csf/Peer.h.
Definition at line 157 of file test/csf/Peer.h.
Definition at line 158 of file test/csf/Peer.h.
Definition at line 159 of file test/csf/Peer.h.
| ripple::test::csf::Peer::Peer | ( | PeerID | i, | 
| Scheduler & | s, | ||
| LedgerOracle & | o, | ||
| BasicNetwork< Peer * > & | n, | ||
| TrustGraph< Peer * > & | tg, | ||
| CollectorRefs & | c, | ||
| beast::Journal | jIn | ||
| ) | 
Constructor.
| i | Unique PeerID | 
| s | Simulation Scheduler | 
| o | Simulation Oracle | 
| n | Simulation network | 
| tg | Simulation trust graph | 
| c | Simulation collectors | 
| jIn | Simulation journal | 
Definition at line 260 of file test/csf/Peer.h.
| void ripple::test::csf::Peer::schedule | ( | std::chrono::nanoseconds | when, | 
| T && | what | ||
| ) | 
Schedule the provided callback in when duration, but if when is 0, call immediately. 
Definition at line 294 of file test/csf/Peer.h.
| void ripple::test::csf::Peer::issue | ( | E const & | event | ) | 
Definition at line 307 of file test/csf/Peer.h.
| void ripple::test::csf::Peer::trust | ( | Peer & | o | ) | 
Definition at line 320 of file test/csf/Peer.h.
| void ripple::test::csf::Peer::untrust | ( | Peer & | o | ) | 
Definition at line 327 of file test/csf/Peer.h.
| bool ripple::test::csf::Peer::trusts | ( | Peer & | o | ) | 
Definition at line 334 of file test/csf/Peer.h.
| bool ripple::test::csf::Peer::trusts | ( | PeerID const & | oId | ) | 
Definition at line 341 of file test/csf/Peer.h.
| bool ripple::test::csf::Peer::connect | ( | Peer & | o, | 
| SimDuration | dur | ||
| ) | 
Create network connection.
Creates a new outbound connection to another Peer if none exists
| o | The peer with the inbound connection | 
| dur | The fixed delay for messages between the two Peers | 
Definition at line 359 of file test/csf/Peer.h.
| bool ripple::test::csf::Peer::disconnect | ( | Peer & | o | ) | 
Remove a network connection.
Removes a connection between peers if one exists
| o | The peer we disconnect from | 
Definition at line 372 of file test/csf/Peer.h.
| Ledger const * ripple::test::csf::Peer::acquireLedger | ( | Ledger::ID const & | ledgerID | ) | 
Definition at line 382 of file test/csf/Peer.h.
Definition at line 429 of file test/csf/Peer.h.
| bool ripple::test::csf::Peer::hasOpenTransactions | ( | ) | const | 
Definition at line 474 of file test/csf/Peer.h.
| std::size_t ripple::test::csf::Peer::proposersValidated | ( | Ledger::ID const & | prevLedger | ) | 
Definition at line 480 of file test/csf/Peer.h.
| std::size_t ripple::test::csf::Peer::proposersFinished | ( | Ledger const & | prevLedger, | 
| Ledger::ID const & | prevLedgerID | ||
| ) | 
Definition at line 486 of file test/csf/Peer.h.
| Result ripple::test::csf::Peer::onClose | ( | Ledger const & | prevLedger, | 
| NetClock::time_point | closeTime, | ||
| ConsensusMode | mode | ||
| ) | 
Definition at line 492 of file test/csf/Peer.h.
| void ripple::test::csf::Peer::onForceAccept | ( | Result const & | result, | 
| Ledger const & | prevLedger, | ||
| NetClock::duration const & | closeResolution, | ||
| ConsensusCloseTimes const & | rawCloseTimes, | ||
| ConsensusMode const & | mode, | ||
| Json::Value && | consensusJson | ||
| ) | 
Definition at line 511 of file test/csf/Peer.h.
| void ripple::test::csf::Peer::onAccept | ( | Result const & | result, | 
| Ledger const & | prevLedger, | ||
| NetClock::duration const & | closeResolution, | ||
| ConsensusCloseTimes const & | rawCloseTimes, | ||
| ConsensusMode const & | mode, | ||
| Json::Value && | consensusJson, | ||
| bool const | validating | ||
| ) | 
Definition at line 530 of file test/csf/Peer.h.
| Ledger::Seq ripple::test::csf::Peer::earliestAllowedSeq | ( | ) | const | 
Definition at line 605 of file test/csf/Peer.h.
| Ledger::ID ripple::test::csf::Peer::getPrevLedger | ( | Ledger::ID const & | ledgerID, | 
| Ledger const & | ledger, | ||
| ConsensusMode | mode | ||
| ) | 
Definition at line 611 of file test/csf/Peer.h.
| void ripple::test::csf::Peer::propose | ( | Proposal const & | pos | ) | 
Definition at line 633 of file test/csf/Peer.h.
| ConsensusParms const & ripple::test::csf::Peer::parms | ( | ) | const | 
Definition at line 639 of file test/csf/Peer.h.
| void ripple::test::csf::Peer::onModeChange | ( | ConsensusMode | , | 
| ConsensusMode | |||
| ) | 
Definition at line 646 of file test/csf/Peer.h.
| void ripple::test::csf::Peer::share | ( | M const & | m | ) | 
Definition at line 653 of file test/csf/Peer.h.
| void ripple::test::csf::Peer::share | ( | Position const & | p | ) | 
Definition at line 661 of file test/csf/Peer.h.
| bool ripple::test::csf::Peer::addTrustedValidation | ( | Validation | v | ) | 
Add a trusted validation and return true if it is worth forwarding.
Definition at line 671 of file test/csf/Peer.h.
| void ripple::test::csf::Peer::checkFullyValidated | ( | Ledger const & | ledger | ) | 
Check if a new ledger can be deemed fully validated.
Definition at line 688 of file test/csf/Peer.h.
| void ripple::test::csf::Peer::send | ( | BroadcastMesg< M > const & | bm, | 
| PeerID | from | ||
| ) | 
Definition at line 741 of file test/csf/Peer.h.
| void ripple::test::csf::Peer::receive | ( | BroadcastMesg< M > const & | bm, | 
| PeerID | from | ||
| ) | 
Definition at line 766 of file test/csf/Peer.h.
| bool ripple::test::csf::Peer::handle | ( | Proposal const & | p | ) | 
Definition at line 782 of file test/csf/Peer.h.
| bool ripple::test::csf::Peer::handle | ( | TxSet const & | txs | ) | 
Definition at line 801 of file test/csf/Peer.h.
| bool ripple::test::csf::Peer::handle | ( | Tx const & | tx | ) | 
Definition at line 812 of file test/csf/Peer.h.
| bool ripple::test::csf::Peer::handle | ( | Validation const & | v | ) | 
Definition at line 824 of file test/csf/Peer.h.
| bool ripple::test::csf::Peer::haveValidated | ( | ) | const | 
Definition at line 835 of file test/csf/Peer.h.
| Ledger::Seq ripple::test::csf::Peer::getValidLedgerIndex | ( | ) | const | 
Definition at line 841 of file test/csf/Peer.h.
| std::pair< std::size_t, hash_set< NodeKey_t > > ripple::test::csf::Peer::getQuorumKeys | ( | ) | 
Definition at line 847 of file test/csf/Peer.h.
| std::size_t ripple::test::csf::Peer::laggards | ( | Ledger::Seq const | seq, | 
| hash_set< NodeKey_t > & | trusted | ||
| ) | 
Definition at line 856 of file test/csf/Peer.h.
| bool ripple::test::csf::Peer::validator | ( | ) | const | 
Definition at line 862 of file test/csf/Peer.h.
| void ripple::test::csf::Peer::updateOperatingMode | ( | std::size_t const | positions | ) | const | 
Definition at line 868 of file test/csf/Peer.h.
| bool ripple::test::csf::Peer::validating | ( | ) | const | 
Definition at line 873 of file test/csf/Peer.h.
| void ripple::test::csf::Peer::submit | ( | Tx const & | tx | ) | 
Definition at line 882 of file test/csf/Peer.h.
| void ripple::test::csf::Peer::timerEntry | ( | ) | 
Heartbeat timer call.
Definition at line 894 of file test/csf/Peer.h.
| void ripple::test::csf::Peer::startRound | ( | ) | 
Definition at line 904 of file test/csf/Peer.h.
| void ripple::test::csf::Peer::start | ( | ) | 
Definition at line 925 of file test/csf/Peer.h.
| NetClock::time_point ripple::test::csf::Peer::now | ( | ) | const | 
Definition at line 934 of file test/csf/Peer.h.
| Ledger::ID ripple::test::csf::Peer::prevLedgerID | ( | ) | const | 
Definition at line 947 of file test/csf/Peer.h.
| beast::WrappedSink ripple::test::csf::Peer::sink | 
Logging support that prefixes messages with the peer ID.
Definition at line 162 of file test/csf/Peer.h.
| beast::Journal ripple::test::csf::Peer::j | 
Definition at line 163 of file test/csf/Peer.h.
Generic consensus.
Definition at line 166 of file test/csf/Peer.h.
| PeerID ripple::test::csf::Peer::id | 
Our unique ID.
Definition at line 169 of file test/csf/Peer.h.
| PeerKey ripple::test::csf::Peer::key | 
Current signing key.
Definition at line 172 of file test/csf/Peer.h.
| LedgerOracle& ripple::test::csf::Peer::oracle | 
The oracle that manages unique ledgers.
Definition at line 175 of file test/csf/Peer.h.
| Scheduler& ripple::test::csf::Peer::scheduler | 
Scheduler of events.
Definition at line 178 of file test/csf/Peer.h.
| BasicNetwork<Peer*>& ripple::test::csf::Peer::net | 
Handle to network for sending messages.
Definition at line 181 of file test/csf/Peer.h.
| TrustGraph<Peer*>& ripple::test::csf::Peer::trustGraph | 
Handle to Trust graph of network.
Definition at line 184 of file test/csf/Peer.h.
| TxSetType ripple::test::csf::Peer::openTxs | 
openTxs that haven't been closed in a ledger yet
Definition at line 187 of file test/csf/Peer.h.
| Ledger ripple::test::csf::Peer::lastClosedLedger | 
The last ledger closed by this node.
Definition at line 190 of file test/csf/Peer.h.
| hash_map<Ledger::ID, Ledger> ripple::test::csf::Peer::ledgers | 
Ledgers this node has closed or loaded from the network.
Definition at line 193 of file test/csf/Peer.h.
| Validations<ValAdaptor> ripple::test::csf::Peer::validations | 
Validations from trusted nodes.
Definition at line 196 of file test/csf/Peer.h.
| Ledger ripple::test::csf::Peer::fullyValidatedLedger | 
The most recent ledger that has been fully validated by the network from the perspective of this Peer.
Definition at line 200 of file test/csf/Peer.h.
| bc::flat_map<Ledger::ID, std::vector<Proposal> > ripple::test::csf::Peer::peerPositions | 
Map from Ledger::ID to vector of Positions with that ledger as the prior ledger.
Definition at line 208 of file test/csf/Peer.h.
TxSet associated with a TxSet::ID.
Definition at line 210 of file test/csf/Peer.h.
| bc::flat_map<Ledger::ID, SimTime> ripple::test::csf::Peer::acquiringLedgers | 
Definition at line 213 of file test/csf/Peer.h.
Definition at line 214 of file test/csf/Peer.h.
| int ripple::test::csf::Peer::completedLedgers = 0 | 
The number of ledgers this peer has completed.
Definition at line 217 of file test/csf/Peer.h.
| int ripple::test::csf::Peer::targetLedgers = std::numeric_limits<int>::max() | 
The number of ledgers this peer should complete before stopping to run.
Definition at line 220 of file test/csf/Peer.h.
| std::chrono::seconds ripple::test::csf::Peer::clockSkew {0} | 
Skew of time relative to the common scheduler clock.
Definition at line 223 of file test/csf/Peer.h.
| ProcessingDelays ripple::test::csf::Peer::delays | 
Simulated delays to use for internal processing.
Definition at line 226 of file test/csf/Peer.h.
| bool ripple::test::csf::Peer::runAsValidator = true | 
Whether to simulate running as validator or a tracking node.
Definition at line 229 of file test/csf/Peer.h.
| std::size_t ripple::test::csf::Peer::prevProposers = 0 | 
Definition at line 233 of file test/csf/Peer.h.
| std::chrono::milliseconds ripple::test::csf::Peer::prevRoundTime | 
Definition at line 235 of file test/csf/Peer.h.
| std::size_t ripple::test::csf::Peer::quorum = 0 | 
Definition at line 239 of file test/csf/Peer.h.
Definition at line 241 of file test/csf/Peer.h.
| ConsensusParms ripple::test::csf::Peer::consensusParms | 
Definition at line 244 of file test/csf/Peer.h.
| CollectorRefs& ripple::test::csf::Peer::collectors | 
The collectors to report events to.
Definition at line 247 of file test/csf/Peer.h.
| Router ripple::test::csf::Peer::router | 
Definition at line 736 of file test/csf/Peer.h.
| hash_map<Ledger::Seq, Tx> ripple::test::csf::Peer::txInjections | 
Definition at line 958 of file test/csf/Peer.h.