mirror of
https://github.com/XRPLF/rippled.git
synced 2025-12-06 17:27:55 +00:00
Redesign CSF framework (RIPD-1361):
- Separate `Scheduler` from `BasicNetwork`. - Add an event/collector framework for monitoring invariants and calculating statistics. - Allow distinct network and trust connections between Peers. - Add a simple routing strategy to support broadcasting arbitrary messages. - Add a common directed graph (`Digraph`) class for representing network and trust topologies. - Add a `PeerGroup` class for simpler specification of the trust and network topologies. - Add a `LedgerOracle` class to ensure distinct ledger histories and simplify branch checking. - Add a `Submitter` to send transactions in at fixed or random intervals to fixed or random peers. Co-authored-by: Joseph McGee
This commit is contained in:
@@ -126,7 +126,7 @@ RCLConsensus::Adaptor::acquireLedger(LedgerHash const& ledger)
|
||||
|
||||
|
||||
void
|
||||
RCLConsensus::Adaptor::relay(RCLCxPeerPos const& peerPos)
|
||||
RCLConsensus::Adaptor::share(RCLCxPeerPos const& peerPos)
|
||||
{
|
||||
protocol::TMProposeSet prop;
|
||||
|
||||
@@ -150,7 +150,7 @@ RCLConsensus::Adaptor::relay(RCLCxPeerPos const& peerPos)
|
||||
}
|
||||
|
||||
void
|
||||
RCLConsensus::Adaptor::relay(RCLCxTx const& tx)
|
||||
RCLConsensus::Adaptor::share(RCLCxTx const& tx)
|
||||
{
|
||||
// If we didn't relay this transaction recently, relay it to all peers
|
||||
if (app_.getHashRouter().shouldRelay(tx.id()))
|
||||
@@ -204,7 +204,7 @@ RCLConsensus::Adaptor::propose(RCLCxPeerPos::Proposal const& proposal)
|
||||
}
|
||||
|
||||
void
|
||||
RCLConsensus::Adaptor::relay(RCLTxSet const& set)
|
||||
RCLConsensus::Adaptor::share(RCLTxSet const& set)
|
||||
{
|
||||
inboundTransactions_.giveSet(set.id(), set.map_, false);
|
||||
}
|
||||
@@ -254,19 +254,7 @@ RCLConsensus::Adaptor::getPrevLedger(
|
||||
app_.getValidations().currentTrustedDistribution(
|
||||
ledgerID, parentID, ledgerMaster_.getValidLedgerIndex());
|
||||
|
||||
uint256 netLgr = ledgerID;
|
||||
int netLgrCount = 0;
|
||||
for (auto const & it : ledgerCounts)
|
||||
{
|
||||
// Switch to ledger supported by more peers
|
||||
// Or stick with ours on a tie
|
||||
if ((it.second > netLgrCount) ||
|
||||
((it.second == netLgrCount) && (it.first == ledgerID)))
|
||||
{
|
||||
netLgr = it.first;
|
||||
netLgrCount = it.second;
|
||||
}
|
||||
}
|
||||
uint256 netLgr = getPreferredLedger(ledgerID, ledgerCounts);
|
||||
|
||||
if (netLgr != ledgerID)
|
||||
{
|
||||
|
||||
@@ -158,21 +158,21 @@ class RCLConsensus
|
||||
boost::optional<RCLCxLedger>
|
||||
acquireLedger(LedgerHash const& ledger);
|
||||
|
||||
/** Relay the given proposal to all peers
|
||||
/** Share the given proposal with all peers
|
||||
|
||||
@param peerPos The peer position to relay.
|
||||
@param peerPos The peer position to share.
|
||||
*/
|
||||
void
|
||||
relay(RCLCxPeerPos const& peerPos);
|
||||
share(RCLCxPeerPos const& peerPos);
|
||||
|
||||
/** Relay disputed transacction to peers.
|
||||
/** Share disputed transaction to peers.
|
||||
|
||||
Only relay if the provided transaction hasn't been shared recently.
|
||||
Only share if the provided transaction hasn't been shared recently.
|
||||
|
||||
@param tx The disputed transaction to relay.
|
||||
@param tx The disputed transaction to share.
|
||||
*/
|
||||
void
|
||||
relay(RCLCxTx const& tx);
|
||||
share(RCLCxTx const& tx);
|
||||
|
||||
/** Acquire the transaction set associated with a proposal.
|
||||
|
||||
@@ -215,12 +215,12 @@ class RCLConsensus
|
||||
void
|
||||
propose(RCLCxPeerPos::Proposal const& proposal);
|
||||
|
||||
/** Relay the given tx set to peers.
|
||||
/** Share the given tx set to peers.
|
||||
|
||||
@param set The TxSet to share.
|
||||
*/
|
||||
void
|
||||
relay(RCLTxSet const& set);
|
||||
share(RCLTxSet const& set);
|
||||
|
||||
/** Get the ID of the previous ledger/last closed ledger(LCL) on the
|
||||
network
|
||||
|
||||
@@ -37,6 +37,8 @@ class RCLCxLedger
|
||||
public:
|
||||
//! Unique identifier of a ledger
|
||||
using ID = LedgerHash;
|
||||
//! Sequence number of a ledger
|
||||
using Seq = LedgerIndex;
|
||||
|
||||
/** Default constructor
|
||||
|
||||
@@ -55,28 +57,28 @@ public:
|
||||
}
|
||||
|
||||
//! Sequence number of the ledger.
|
||||
auto const&
|
||||
Seq const&
|
||||
seq() const
|
||||
{
|
||||
return ledger_->info().seq;
|
||||
}
|
||||
|
||||
//! Unique identifier (hash) of this ledger.
|
||||
auto const&
|
||||
ID const&
|
||||
id() const
|
||||
{
|
||||
return ledger_->info().hash;
|
||||
}
|
||||
|
||||
//! Unique identifier (hash) of this ledger's parent.
|
||||
auto const&
|
||||
ID const&
|
||||
parentID() const
|
||||
{
|
||||
return ledger_->info().parentHash;
|
||||
}
|
||||
|
||||
//! Resolution used when calculating this ledger's close time.
|
||||
auto
|
||||
NetClock::duration
|
||||
closeTimeResolution() const
|
||||
{
|
||||
return ledger_->info().closeTimeResolution;
|
||||
@@ -90,14 +92,14 @@ public:
|
||||
}
|
||||
|
||||
//! The close time of this ledger
|
||||
auto
|
||||
NetClock::time_point
|
||||
closeTime() const
|
||||
{
|
||||
return ledger_->info().closeTime;
|
||||
}
|
||||
|
||||
//! The close time of this ledger's parent.
|
||||
auto
|
||||
NetClock::time_point
|
||||
parentCloseTime() const
|
||||
{
|
||||
return ledger_->info().parentCloseTime;
|
||||
|
||||
Reference in New Issue
Block a user