mirror of
https://github.com/XRPLF/rippled.git
synced 2025-11-21 11:35:53 +00:00
Allow maximum send to use reserve for fees.
This commit is contained in:
@@ -141,9 +141,10 @@ TER PaymentTransactor::doApply()
|
|||||||
const STAmount saSrcXRPBalance = mTxnAccount->getFieldAmount(sfBalance);
|
const STAmount saSrcXRPBalance = mTxnAccount->getFieldAmount(sfBalance);
|
||||||
const uint32 uOwnerCount = mTxnAccount->getFieldU32(sfOwnerCount);
|
const uint32 uOwnerCount = mTxnAccount->getFieldU32(sfOwnerCount);
|
||||||
const uint64 uReserve = mEngine->getLedger()->getReserve(uOwnerCount);
|
const uint64 uReserve = mEngine->getLedger()->getReserve(uOwnerCount);
|
||||||
|
STAmount saPaid = mTxn.getTransactionFee();
|
||||||
|
|
||||||
// Make sure have enough reserve to send.
|
// Make sure have enough reserve to send. Allow final spend to use reserve for fee.
|
||||||
if (saSrcXRPBalance < saDstAmount + uReserve) // Reserve is not scaled by fee.
|
if (saSrcXRPBalance + saPaid < saDstAmount + uReserve) // Reserve is not scaled by fee.
|
||||||
{
|
{
|
||||||
// Vote no. However, transaction might succeed, if applied in a different order.
|
// Vote no. However, transaction might succeed, if applied in a different order.
|
||||||
cLog(lsINFO) << "";
|
cLog(lsINFO) << "";
|
||||||
|
|||||||
@@ -113,9 +113,13 @@ TER TransactionEngine::applyTransaction(const SerializedTransaction& txn, Transa
|
|||||||
cLog(lsINFO) << "applyTransaction: terResult=" << strToken << " : " << terResult << " : " << strHuman;
|
cLog(lsINFO) << "applyTransaction: terResult=" << strToken << " : " << terResult << " : " << strHuman;
|
||||||
|
|
||||||
if (terResult == tesSUCCESS)
|
if (terResult == tesSUCCESS)
|
||||||
|
{
|
||||||
didApply = true;
|
didApply = true;
|
||||||
|
}
|
||||||
else if (isTepPartial(terResult) && !isSetBit(params, tapRETRY))
|
else if (isTepPartial(terResult) && !isSetBit(params, tapRETRY))
|
||||||
|
{
|
||||||
didApply = true;
|
didApply = true;
|
||||||
|
}
|
||||||
else if (isTecClaim(terResult) && !isSetBit(params, tapRETRY))
|
else if (isTecClaim(terResult) && !isSetBit(params, tapRETRY))
|
||||||
{ // only claim the transaction fee
|
{ // only claim the transaction fee
|
||||||
cLog(lsINFO) << "Reprocessing to only claim fee";
|
cLog(lsINFO) << "Reprocessing to only claim fee";
|
||||||
@@ -142,7 +146,9 @@ TER TransactionEngine::applyTransaction(const SerializedTransaction& txn, Transa
|
|||||||
STAmount balance = txnAcct->getFieldAmount(sfBalance);
|
STAmount balance = txnAcct->getFieldAmount(sfBalance);
|
||||||
|
|
||||||
if (balance < fee)
|
if (balance < fee)
|
||||||
|
{
|
||||||
terResult = terINSUF_FEE_B;
|
terResult = terINSUF_FEE_B;
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
txnAcct->setFieldAmount(sfBalance, balance - fee);
|
txnAcct->setFieldAmount(sfBalance, balance - fee);
|
||||||
|
|||||||
Reference in New Issue
Block a user