Fix a bug where a cached copy of a txn might not have a reference to the ledger

it was applied in, causing commands like 'tx' not to return metadata.
This commit is contained in:
JoelKatz
2013-02-27 18:23:24 -08:00
parent ab89fbdcf6
commit 312e476898
3 changed files with 16 additions and 2 deletions

View File

@@ -18,13 +18,24 @@ TransactionMaster::TransactionMaster() : mCache("TransactionCache", CACHED_TRANS
;
}
bool TransactionMaster::inLedger(const uint256& hash, uint32 ledger)
{
Transaction::pointer txn = mCache.fetch(hash);
if (!txn)
return false;
txn->setStatus(COMMITTED, ledger);
return true;
}
Transaction::pointer TransactionMaster::fetch(const uint256& txnID, bool checkDisk)
{
Transaction::pointer txn = mCache.fetch(txnID);
if (!checkDisk || txn) return txn;
if (!checkDisk || txn)
return txn;
txn = Transaction::load(txnID);
if (!txn) return txn;
if (!txn)
return txn;
mCache.canonicalize(txnID, txn);