Switch to the new LedgerEntrySet code. This provides more sophisticated checkpointing and rewinding.

This commit is contained in:
JoelKatz
2012-07-26 04:07:37 -07:00
parent b575e72093
commit 5fa4bad9b5
4 changed files with 41 additions and 95 deletions

View File

@@ -64,7 +64,7 @@ void LedgerEntrySet::entryCreate(SLE::pointer sle)
if (it == mEntries.end())
mEntries.insert(std::make_pair(sle->getIndex(), LedgerEntrySetEntry(sle, taaDELETE, mSeq)));
else if (it->second.mAction == taaDELETE)
throw std::runtime_error("Create after delete");
throw std::runtime_error("Create after delete"); // We could make this a modify
else if (it->second.mAction == taaMODIFY)
throw std::runtime_error("Create after modify");
else
@@ -89,3 +89,18 @@ void LedgerEntrySet::entryModify(SLE::pointer sle)
it->second.mAction = (it->second.mAction == taaCREATE) ? taaCREATE : taaDELETE;
}
}
void LedgerEntrySet::entryDelete(SLE::pointer sle)
{
boost::unordered_map<uint256, LedgerEntrySetEntry>::iterator it = mEntries.find(sle->getIndex());
if (it == mEntries.end())
mEntries.insert(std::make_pair(sle->getIndex(), LedgerEntrySetEntry(sle, taaDELETE, mSeq)));
else if (it->second.mAction == taaCREATE) // We support delete after create
mEntries.erase(it);
else
{
it->second.mSeq = mSeq;
it->second.mEntry = sle;
it->second.mAction = taaDELETE;
}
}