More work on ledger sequencing:

Track whether ledger is accepted.
	Assert on modifications to an accepted ledger.
	Save accepted ledgers to DB.
	Load ledger by hash/index.
	Ledger history functions, ledger canonicalization.
	'Push' ledger to history.
This commit is contained in:
JoelKatz
2011-12-13 18:05:29 -08:00
parent 80a6f7e5ad
commit 4b5bc85a0d
6 changed files with 169 additions and 30 deletions

View File

@@ -24,6 +24,23 @@ uint64 LedgerMaster::getBalance(std::string& addr)
return mCurrentLedger->getBalance(humanTo160(addr));
}
bool LedgerMaster::addTransaction(Transaction::pointer transaction)
{
return mCurrentLedger->applyTransaction(transaction)==Ledger::TR_SUCCESS;
}
void LedgerMaster::pushLedger(Ledger::pointer newLedger)
{
ScopedLock sl(mLock);
if(!!mFinalizingLedger)
{
mFinalizingLedger->setClosed();
mFinalizingLedger->setAccepted();
mLedgerHistory.addAcceptedLedger(mFinalizingLedger);
}
mFinalizingLedger=mCurrentLedger;
mCurrentLedger=newLedger;
}
#if 0