mirror of
https://github.com/Xahau/xahaud.git
synced 2025-12-06 17:27:52 +00:00
Be more robust about storing/replaying proposals:
Store a proposal even if it arrives outside a round. Make sure we catch up on any missed proposals as we start a round.
This commit is contained in:
@@ -138,7 +138,7 @@ ConsensusImp::storeProposal (
|
||||
{
|
||||
auto& props = storedProposals_[peerPublic.getNodeID ()];
|
||||
|
||||
if (props.size () >= (unsigned) (getLastCloseProposers () + 10))
|
||||
if (props.size () >= 10)
|
||||
props.pop_front ();
|
||||
|
||||
props.push_back (proposal);
|
||||
|
||||
@@ -300,6 +300,14 @@ LedgerConsensusImp::LedgerConsensusImp (
|
||||
// update the network status table as to whether we're
|
||||
// proposing/validating
|
||||
consensus_.setProposing (mProposing, mValidating);
|
||||
|
||||
playbackProposals ();
|
||||
if (mPeerPositions.size() > (mPreviousProposers / 2))
|
||||
{
|
||||
// We may be falling behind, don't wait for the timer
|
||||
// consider closing the ledger immediately
|
||||
timerEntry ();
|
||||
}
|
||||
}
|
||||
|
||||
Json::Value LedgerConsensusImp::getJson (bool full)
|
||||
@@ -974,8 +982,6 @@ void LedgerConsensusImp::accept (std::shared_ptr<SHAMap> set)
|
||||
consensus_.takePosition (mPreviousLedger->info().seq, set);
|
||||
|
||||
assert (set->getHash () == mOurPosition->getCurrentHash ());
|
||||
// these are now obsolete
|
||||
consensus_.peekStoredProposals ().clear ();
|
||||
}
|
||||
|
||||
auto closeTime = mOurPosition->getCloseTime ();
|
||||
|
||||
@@ -1489,6 +1489,11 @@ void NetworkOPsImp::processTrustedProposal (
|
||||
|
||||
bool relay = true;
|
||||
|
||||
if (mConsensus)
|
||||
mConsensus->storeProposal (proposal, nodePublic);
|
||||
else
|
||||
m_journal.warning << "Unable to store proposal";
|
||||
|
||||
if (!haveConsensusObject ())
|
||||
{
|
||||
m_journal.info << "Received proposal outside consensus window";
|
||||
@@ -1496,17 +1501,15 @@ void NetworkOPsImp::processTrustedProposal (
|
||||
if (mMode == omFULL)
|
||||
relay = false;
|
||||
}
|
||||
else
|
||||
else if (mLedgerConsensus->getLCL () == proposal->getPrevLedger ())
|
||||
{
|
||||
mConsensus->storeProposal (proposal, nodePublic);
|
||||
|
||||
if (mLedgerConsensus->getLCL () == proposal->getPrevLedger ())
|
||||
{
|
||||
relay = mLedgerConsensus->peerPosition (proposal);
|
||||
m_journal.trace
|
||||
<< "Proposal processing finished, relay=" << relay;
|
||||
}
|
||||
relay = mLedgerConsensus->peerPosition (proposal);
|
||||
m_journal.trace
|
||||
<< "Proposal processing finished, relay=" << relay;
|
||||
}
|
||||
else
|
||||
m_journal.debug << "Got proposal for " << proposal->getPrevLedger ()
|
||||
<< " but we are on " << mLedgerConsensus->getLCL();
|
||||
|
||||
if (relay)
|
||||
app_.overlay().relay(*set, proposal->getSuppressionID());
|
||||
|
||||
Reference in New Issue
Block a user