mirror of
https://github.com/XRPLF/rippled.git
synced 2025-12-06 17:27:55 +00:00
Pause for lagging validators.
This commit is contained in:
@@ -22,6 +22,7 @@
|
||||
#include <ripple/beast/utility/WrappedSink.h>
|
||||
#include <ripple/consensus/Consensus.h>
|
||||
#include <ripple/consensus/Validations.h>
|
||||
#include <ripple/protocol/PublicKey.h>
|
||||
#include <boost/container/flat_map.hpp>
|
||||
#include <boost/container/flat_set.hpp>
|
||||
#include <algorithm>
|
||||
@@ -165,9 +166,11 @@ struct Peer
|
||||
//! Type definitions for generic consensus
|
||||
using Ledger_t = Ledger;
|
||||
using NodeID_t = PeerID;
|
||||
using NodeKey_t = PeerKey;
|
||||
using TxSet_t = TxSet;
|
||||
using PeerPosition_t = Position;
|
||||
using Result = ConsensusResult<Peer>;
|
||||
using NodeKey = Validation::NodeKey;
|
||||
|
||||
//! Logging support that prefixes messages with the peer ID
|
||||
beast::WrappedSink sink;
|
||||
@@ -239,10 +242,7 @@ struct Peer
|
||||
//! Whether to simulate running as validator or a tracking node
|
||||
bool runAsValidator = true;
|
||||
|
||||
//! Enforce invariants on validation sequence numbers
|
||||
SeqEnforcer<Ledger::Seq> seqEnforcer;
|
||||
|
||||
//TODO: Consider removing these two, they are only a convenience for tests
|
||||
// TODO: Consider removing these two, they are only a convenience for tests
|
||||
// Number of proposers in the prior round
|
||||
std::size_t prevProposers = 0;
|
||||
// Duration of prior round
|
||||
@@ -252,6 +252,8 @@ struct Peer
|
||||
// TODO: Use the logic in ValidatorList to set this dynamically
|
||||
std::size_t quorum = 0;
|
||||
|
||||
hash_set<NodeKey_t> trustedKeys;
|
||||
|
||||
// Simulation parameters
|
||||
ConsensusParms consensusParms;
|
||||
|
||||
@@ -574,8 +576,7 @@ struct Peer
|
||||
|
||||
// Can only send one validated ledger per seq
|
||||
if (runAsValidator && isCompatible && !consensusFail &&
|
||||
seqEnforcer(
|
||||
scheduler.now(), newLedger.seq(), validations.parms()))
|
||||
validations.canValidateSeq(newLedger.seq()))
|
||||
{
|
||||
bool isFull = proposing;
|
||||
|
||||
@@ -837,6 +838,39 @@ struct Peer
|
||||
return addTrustedValidation(v);
|
||||
}
|
||||
|
||||
bool
|
||||
haveValidated() const
|
||||
{
|
||||
return fullyValidatedLedger.seq() > Ledger::Seq{0};
|
||||
}
|
||||
|
||||
Ledger::Seq
|
||||
getValidLedgerIndex() const
|
||||
{
|
||||
return earliestAllowedSeq();
|
||||
}
|
||||
|
||||
std::pair<std::size_t, hash_set<NodeKey_t>>
|
||||
getQuorumKeys()
|
||||
{
|
||||
hash_set<NodeKey_t > keys;
|
||||
for (auto const& p : trustGraph.trustedPeers(this))
|
||||
keys.insert(p->key);
|
||||
return {quorum, keys};
|
||||
}
|
||||
|
||||
std::size_t
|
||||
laggards(Ledger::Seq const seq, hash_set<NodeKey_t>& trustedKeys)
|
||||
{
|
||||
return validations.laggards(seq, trustedKeys);
|
||||
}
|
||||
|
||||
bool
|
||||
validator() const
|
||||
{
|
||||
return runAsValidator;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
// A locally submitted transaction
|
||||
void
|
||||
|
||||
Reference in New Issue
Block a user