Handle sequence numbers better in peer messages.

This commit is contained in:
JoelKatz
2013-08-14 12:57:55 -07:00
parent 832b2f6b4f
commit be1ca396c5
3 changed files with 16 additions and 6 deletions

View File

@@ -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);

View File

@@ -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;

View File

@@ -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)