Don't remove shot down ledgers from the range we propagate to peers.

This commit is contained in:
JoelKatz
2013-08-12 11:46:02 -07:00
parent 69477c96ca
commit f4c6fa7873
6 changed files with 33 additions and 9 deletions

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@@ -120,6 +120,10 @@ public:
{
return mLedgerMaster->getValidatedRange (minVal, maxVal);
}
bool getFullValidatedRange (uint32& minVal, uint32& maxVal)
{
return mLedgerMaster->getFullValidatedRange (minVal, maxVal);
}
SerializedValidation::ref getLastValidation ()
{