Don't charge for transactions twice. Have the "old" getTransaction handle metadata sanely.

Fix calcRawMeta to fit the new model where an LES holds a reference to its ledger
Don't put metadata in open ledger txn sets to avoid breaking the proposal mechanism.
This commit is contained in:
JoelKatz
2012-09-13 01:01:40 -07:00
parent d2336e3eea
commit 953f0ad63f
4 changed files with 40 additions and 15 deletions

View File

@@ -232,14 +232,30 @@ bool Ledger::addTransaction(const uint256& txID, const Serializer& txn, const Se
Transaction::pointer Ledger::getTransaction(const uint256& transID) const
{
SHAMapItem::pointer item = mTransactionMap->peekItem(transID);
SHAMapTreeNode::TNType type;
SHAMapItem::pointer item = mTransactionMap->peekItem(transID, type);
if (!item) return Transaction::pointer();
Transaction::pointer txn = theApp->getMasterTransaction().fetch(transID, false);
if (txn)
return txn;
txn = Transaction::sharedTransaction(item->getData(), true);
if (type == SHAMapTreeNode::tnTRANSACTION_NM)
txn = Transaction::sharedTransaction(item->getData(), true);
else if (type == SHAMapTreeNode::tnTRANSACTION_MD)
{
std::vector<unsigned char> txnData;
int txnLength;
if (!item->peekSerializer().getVL(txnData, 0, txnLength))
return Transaction::pointer();
txn = Transaction::sharedTransaction(txnData, false);
}
else
{
assert(false);
return Transaction::pointer();
}
if (txn->getStatus() == NEW)
txn->setStatus(mClosed ? COMMITTED : INCLUDED, mLedgerSeq);