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

@@ -430,10 +430,10 @@ TER TransactionEngine::applyTransaction(const SerializedTransaction& txn, Transa
break;
case ttCONTRACT:
terResult= doContractAdd(txn);
terResult = doContractAdd(txn);
break;
case ttCONTRACT_REMOVE:
terResult=doContractRemove(txn);
terResult = doContractRemove(txn);
break;
default:
@@ -461,14 +461,23 @@ TER TransactionEngine::applyTransaction(const SerializedTransaction& txn, Transa
txnWrite();
Serializer s;
txn.add(s);
if (!mLedger->addTransaction(txID, s))
assert(false);
if (isSetBit(params, tapOPEN_LEDGER))
{
if (!mLedger->addTransaction(txID, s))
assert(false);
}
else
{
Serializer m;
mNodes.calcRawMeta(m);
if (!mLedger->addTransaction(txID, s, m))
assert(false);
// Charge whatever fee they specified.
mLedger->destroyCoins(saPaid.getNValue());
// Charge whatever fee they specified.
mLedger->destroyCoins(saPaid.getNValue());
}
}
mTxnAccount = SLE::pointer();