mirror of
https://github.com/XRPLF/rippled.git
synced 2025-11-25 05:25:55 +00:00
Improve Consensus interface and documentation (RIPD-1340):
- Add Consensus::Result, which represents the result of the establish state and includes the consensus transaction set, final proposed position and disputes. - Add Consensus::Mode to track how we are participating in consensus and ensures the onAccept callback can distinguish when we entered the round with consensus versus when we recovered from a wrong ledger during a round. - Rename Consensus::Phase to Consensus::State and eliminate the processing phase. Instead, accept is a terminal phase which notifies RCLConsensus via onAccept callbacks. Even if clients dispatch accepting to another thread, all future calls except to startRound will not change the state of consensus. - Move validate_ status from Consensus to RCLConsensus, since generic implementation does not directly reference whether a node is validating or not. - Eliminate gotTxSetInternal and handle externally received TxSets distinct from locally generated positions. - Change ConsensusProposal::changePosition to always update the internal close time and position even if we have bowed out. This enforces the invariant that our proposal's position always matches our transaction set.
This commit is contained in:
@@ -322,7 +322,7 @@ private:
|
||||
|
||||
public:
|
||||
bool beginConsensus (uint256 const& networkClosed) override;
|
||||
void endConsensus (bool correctLCL) override;
|
||||
void endConsensus () override;
|
||||
void setStandAlone () override
|
||||
{
|
||||
setMode (omFULL);
|
||||
@@ -1525,7 +1525,7 @@ bool NetworkOPsImp::beginConsensus (uint256 const& networkClosed)
|
||||
|
||||
uint256 NetworkOPsImp::getConsensusLCL ()
|
||||
{
|
||||
return mConsensus->LCL ();
|
||||
return mConsensus->prevLedgerID ();
|
||||
}
|
||||
|
||||
void NetworkOPsImp::processTrustedProposal (
|
||||
@@ -1565,7 +1565,7 @@ NetworkOPsImp::mapComplete (
|
||||
RCLTxSet{map});
|
||||
}
|
||||
|
||||
void NetworkOPsImp::endConsensus (bool correctLCL)
|
||||
void NetworkOPsImp::endConsensus ()
|
||||
{
|
||||
uint256 deadLedger = m_ledgerMaster.getClosedLedger ()->info().parentHash;
|
||||
|
||||
@@ -2164,18 +2164,18 @@ Json::Value NetworkOPsImp::getServerInfo (bool human, bool admin)
|
||||
info[jss::peers] = Json::UInt (app_.overlay ().size ());
|
||||
|
||||
Json::Value lastClose = Json::objectValue;
|
||||
lastClose[jss::proposers] = mConsensus->getLastCloseProposers();
|
||||
lastClose[jss::proposers] = Json::UInt(mConsensus->prevProposers());
|
||||
|
||||
if (human)
|
||||
{
|
||||
lastClose[jss::converge_time_s] =
|
||||
std::chrono::duration<double>{
|
||||
mConsensus->getLastConvergeDuration()}.count();
|
||||
mConsensus->prevRoundTime()}.count();
|
||||
}
|
||||
else
|
||||
{
|
||||
lastClose[jss::converge_time] =
|
||||
Json::Int (mConsensus->getLastConvergeDuration().count());
|
||||
Json::Int (mConsensus->prevRoundTime().count());
|
||||
}
|
||||
|
||||
info[jss::last_close] = lastClose;
|
||||
@@ -2754,9 +2754,7 @@ std::uint32_t NetworkOPsImp::acceptLedger (
|
||||
// FIXME Could we improve on this and remove the need for a specialized
|
||||
// API in Consensus?
|
||||
beginConsensus (m_ledgerMaster.getClosedLedger()->info().hash);
|
||||
mConsensus->simulate (
|
||||
app_.timeKeeper().closeTime(),
|
||||
consensusDelay);
|
||||
mConsensus->simulate (app_.timeKeeper().closeTime(), consensusDelay);
|
||||
return m_ledgerMaster.getCurrentLedger ()->info().seq;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user