mirror of
https://github.com/XRPLF/rippled.git
synced 2025-11-26 14:05:51 +00:00
Properly handle tec return codes. This won't compile until isTecClaim exists.
This commit is contained in:
@@ -110,13 +110,31 @@ TER TransactionEngine::applyTransaction(const SerializedTransaction& txn, Transa
|
|||||||
|
|
||||||
cLog(lsINFO) << "applyTransaction: terResult=" << strToken << " : " << terResult << " : " << strHuman;
|
cLog(lsINFO) << "applyTransaction: terResult=" << strToken << " : " << terResult << " : " << strHuman;
|
||||||
|
|
||||||
if (isTepPartial(terResult) && isSetBit(params, tapRETRY))
|
bool applyTransaction = false;
|
||||||
{
|
|
||||||
// Partial result and allowed to retry, reclassify as a retry.
|
if (terResult == tesSUCCESS)
|
||||||
terResult = terRETRY;
|
applyTransaction = true;
|
||||||
|
else if (isTepPartial(terResult) && !isSetBit(params, tapRETRY))
|
||||||
|
applyTransaction = true;
|
||||||
|
else if (isTecClaim(terResult) && !isSetBit(params, tapRETRY))
|
||||||
|
{ // only claim the transaction fee
|
||||||
|
mNodes.clear();
|
||||||
|
|
||||||
|
SLE::pointer txnAcct = entryCache(ltACCOUNT_ROOT, Ledger::getAccountRootIndex(txn.getSourceAccount()));
|
||||||
|
STAmount fee = txn.getTransactionFee();
|
||||||
|
STAmount balance = txnAcct->getFieldAmount(sfBalance);
|
||||||
|
|
||||||
|
if (balance < fee)
|
||||||
|
terResult = terINSUF_FEE_B;
|
||||||
|
else
|
||||||
|
{
|
||||||
|
txnAcct->setFieldAmount(sfBalance, balance - fee);
|
||||||
|
applyTransaction = true;
|
||||||
|
entryModify(txnAcct);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((tesSUCCESS == terResult) || isTepPartial(terResult))
|
if (applyTransaction)
|
||||||
{
|
{
|
||||||
// Transaction succeeded fully or (retries are not allowed and the transaction succeeded partially).
|
// Transaction succeeded fully or (retries are not allowed and the transaction succeeded partially).
|
||||||
Serializer m;
|
Serializer m;
|
||||||
|
|||||||
Reference in New Issue
Block a user