Missing function Ledger::writeBack

This commit is contained in:
JoelKatz
2012-04-19 03:45:33 -07:00
parent 7c7ee23c64
commit 693df8bb8a

View File

@@ -3,6 +3,27 @@
#include "boost/make_shared.hpp"
LedgerStateParms Ledger::writeBack(LedgerStateParms parms, SerializedLedgerEntry::pointer entry)
{
ScopedLock l(mAccountStateMap->Lock());
bool create = false;
if (!mAccountStateMap->hasItem(entry->getIndex()))
{
if ((parms & lepCREATE) == 0)
return lepMISSING;
create = true;
}
SHAMapItem::pointer item = boost::make_shared<SHAMapItem>(entry->getIndex());
entry->add(item->peekSerializer());
if (!mAccountStateMap->updateGiveItem(item, false))
return lepERROR;
return create ? lepCREATED : lepOKAY;
}
SerializedLedgerEntry::pointer Ledger::getAccountRoot(LedgerStateParms& parms, const uint160& accountID)
{
uint256 nodeID=getAccountRootIndex(accountID);