mirror of
https://github.com/XRPLF/rippled.git
synced 2025-11-28 15:05:53 +00:00
Don't remove shot down ledgers from the range we propagate to peers.
This commit is contained in:
@@ -413,7 +413,7 @@ void LedgerConsensus::statusChange (protocol::NodeEvent event, Ledger& ledger)
|
||||
s.set_ledgerhash (hash.begin (), hash.size ());
|
||||
|
||||
uint32 uMin, uMax;
|
||||
getApp().getOPs ().getValidatedRange (uMin, uMax);
|
||||
getApp().getOPs ().getFullValidatedRange (uMin, uMax);
|
||||
s.set_firstseq (uMin);
|
||||
s.set_lastseq (uMax);
|
||||
|
||||
|
||||
@@ -235,8 +235,30 @@ bool LedgerMaster::haveLedger (uint32 seq)
|
||||
return mCompleteLedgers.hasValue (seq);
|
||||
}
|
||||
|
||||
bool LedgerMaster::getFullValidatedRange (uint32& minVal, uint32& maxVal)
|
||||
{ // Ledgers we have all the nodes for
|
||||
boost::recursive_mutex::scoped_lock sl (mLock);
|
||||
|
||||
if (!mPubLedger)
|
||||
return false;
|
||||
|
||||
maxVal = mPubLedger->getLedgerSeq ();
|
||||
|
||||
if (maxVal == 0)
|
||||
return false;
|
||||
|
||||
minVal = mCompleteLedgers.prevMissing (maxVal);
|
||||
|
||||
if (minVal == RangeSet::absent)
|
||||
minVal = 0;
|
||||
else
|
||||
++minVal;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool LedgerMaster::getValidatedRange (uint32& minVal, uint32& maxVal)
|
||||
{
|
||||
{ // Ledgers we have all the nodes for and are indexed
|
||||
boost::recursive_mutex::scoped_lock sl (mLock);
|
||||
|
||||
if (!mPubLedger)
|
||||
|
||||
@@ -157,6 +157,7 @@ public:
|
||||
bool haveLedgerRange (uint32 from, uint32 to);
|
||||
bool haveLedger (uint32 seq);
|
||||
bool getValidatedRange (uint32& minVal, uint32& maxVal);
|
||||
bool getFullValidatedRange (uint32& minVal, uint32& maxVal);
|
||||
|
||||
void tune (int size, int age)
|
||||
{
|
||||
|
||||
@@ -228,7 +228,7 @@ void InboundLedger::addPeers ()
|
||||
}
|
||||
|
||||
if (!found)
|
||||
for (int i = 0; i < ((vSize > 3) ? 3 : vSize); ++i)
|
||||
for (int i = 0; i < ((vSize > 6) ? 6 : vSize); ++i)
|
||||
peerHas (peerList[ (i + firstPeer) % vSize]);
|
||||
}
|
||||
|
||||
|
||||
@@ -2353,7 +2353,7 @@ bool NetworkOPs::shouldFetchPack (uint32 seq)
|
||||
{
|
||||
uint32 now = getNetworkTimeNC ();
|
||||
|
||||
if ((mLastFetchPack == now) || ((mLastFetchPack + 1) == now))
|
||||
if (mLastFetchPack == now)
|
||||
return false;
|
||||
|
||||
if (seq < mFetchSeq) // fetch pack has only data for ledgers ahead of where we are
|
||||
@@ -2362,14 +2362,11 @@ bool NetworkOPs::shouldFetchPack (uint32 seq)
|
||||
mFetchPack.sweep ();
|
||||
|
||||
int size = mFetchPack.getCacheSize ();
|
||||
|
||||
if (size == 0)
|
||||
{
|
||||
// VFALCO TODO Give this magic number a name
|
||||
//
|
||||
mFetchSeq = static_cast<uint32> (-1);
|
||||
mFetchSeq = 0;
|
||||
}
|
||||
else if (size > 64)
|
||||
else if (size > 128)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -120,6 +120,10 @@ public:
|
||||
{
|
||||
return mLedgerMaster->getValidatedRange (minVal, maxVal);
|
||||
}
|
||||
bool getFullValidatedRange (uint32& minVal, uint32& maxVal)
|
||||
{
|
||||
return mLedgerMaster->getFullValidatedRange (minVal, maxVal);
|
||||
}
|
||||
|
||||
SerializedValidation::ref getLastValidation ()
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user