If we detect a missing node in a ledger we're supposed to have full,

re-acquire that ledger to fill the hole.
This commit is contained in:
JoelKatz
2013-05-08 15:55:52 -07:00
parent ddcebec5a5
commit 41b70c76da
6 changed files with 24 additions and 2 deletions

View File

@@ -54,7 +54,7 @@ std::size_t hash_value(const uint160& u)
}
SHAMap::SHAMap(SHAMapType t, uint32 seq) : mSeq(seq), mState(smsModifying), mType(t)
SHAMap::SHAMap(SHAMapType t, uint32 seq) : mSeq(seq), mLedgerSeq(0), mState(smsModifying), mType(t)
{
if (t == smtSTATE)
mTNByID.rehash(STATE_MAP_BUCKETS);
@@ -63,7 +63,7 @@ SHAMap::SHAMap(SHAMapType t, uint32 seq) : mSeq(seq), mState(smsModifying), mTyp
mTNByID[*root] = root;
}
SHAMap::SHAMap(SHAMapType t, const uint256& hash) : mSeq(1), mState(smsSynching), mType(t)
SHAMap::SHAMap(SHAMapType t, const uint256& hash) : mSeq(1), mLedgerSeq(0), mState(smsSynching), mType(t)
{ // FIXME: Need to acquire root node
if (t == smtSTATE)
mTNByID.rehash(STATE_MAP_BUCKETS);
@@ -723,6 +723,11 @@ SHAMapTreeNode::pointer SHAMap::fetchNodeExternal(const SHAMapNode& id, const ui
if (!obj)
{
// cLog(lsTRACE) << "fetchNodeExternal: missing " << hash;
if (mLedgerSeq != 0)
{
theApp->getOPs().missingNodeInLedger(mLedgerSeq);
mLedgerSeq = 0;
}
throw SHAMapMissingNode(mType, id, hash);
}