mirror of
https://github.com/XRPLF/rippled.git
synced 2025-11-20 11:05:54 +00:00
Handle sequence numbers better in peer messages.
This commit is contained in:
@@ -413,7 +413,11 @@ void LedgerConsensus::statusChange (protocol::NodeEvent event, Ledger& ledger)
|
||||
s.set_ledgerhash (hash.begin (), hash.size ());
|
||||
|
||||
uint32 uMin, uMax;
|
||||
getApp().getOPs ().getFullValidatedRange (uMin, uMax);
|
||||
if (!getApp().getOPs ().getFullValidatedRange (uMin, uMax))
|
||||
{
|
||||
uMin = 0;
|
||||
uMax = 0;
|
||||
}
|
||||
s.set_firstseq (uMin);
|
||||
s.set_lastseq (uMax);
|
||||
|
||||
|
||||
@@ -250,7 +250,7 @@ bool LedgerMaster::getFullValidatedRange (uint32& minVal, uint32& maxVal)
|
||||
minVal = mCompleteLedgers.prevMissing (maxVal);
|
||||
|
||||
if (minVal == RangeSet::absent)
|
||||
minVal = 0;
|
||||
minVal = maxVal;
|
||||
else
|
||||
++minVal;
|
||||
|
||||
@@ -272,7 +272,7 @@ bool LedgerMaster::getValidatedRange (uint32& minVal, uint32& maxVal)
|
||||
minVal = mCompleteLedgers.prevMissing (maxVal);
|
||||
|
||||
if (minVal == RangeSet::absent)
|
||||
minVal = 0;
|
||||
minVal = maxVal;
|
||||
else
|
||||
++minVal;
|
||||
|
||||
|
||||
@@ -1798,11 +1798,17 @@ void PeerImp::recvStatus (protocol::TMStatusChange& packet)
|
||||
}
|
||||
else mPreviousLedgerHash.zero ();
|
||||
|
||||
if (packet.has_firstseq ())
|
||||
if (packet.has_firstseq () && packet.has_lastseq())
|
||||
{
|
||||
mMinLedger = packet.firstseq ();
|
||||
|
||||
if (packet.has_lastseq ())
|
||||
mMaxLedger = packet.lastseq ();
|
||||
|
||||
// Work around some servers that report sequences incorrectly
|
||||
if (mMinLedger == 0)
|
||||
mMaxLedger = 0;
|
||||
if (mMaxLedger == 0)
|
||||
mMinLedger = 0;
|
||||
}
|
||||
}
|
||||
|
||||
void PeerImp::recvGetLedger (protocol::TMGetLedger& packet, Application::ScopedLockType& masterLockHolder)
|
||||
|
||||
Reference in New Issue
Block a user