mirror of
https://github.com/Xahau/xahaud.git
synced 2025-12-06 17:27:52 +00:00
escrow bug fixes, escrow create/finish/cancel working
This commit is contained in:
@@ -632,7 +632,7 @@ EscrowFinish::doApply()
|
|||||||
<< "EscrowFinish::doApply trustTransferLockedBalance (wet) result="
|
<< "EscrowFinish::doApply trustTransferLockedBalance (wet) result="
|
||||||
<< result;
|
<< result;
|
||||||
|
|
||||||
if (isTesSuccess(result))
|
if (!isTesSuccess(result))
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -531,13 +531,13 @@ trustAdjustLockedBalance(
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/** Check if movement of a particular token between 1 or more accounts
|
/** Check if a set of accounts can freely exchange the specified token.
|
||||||
Read only, does not change any ledger object.
|
Read only, does not change any ledger object.
|
||||||
May be called with ApplyView or ReadView.
|
May be called with ApplyView or ReadView.
|
||||||
(including unlocking) is forbidden by any flag or condition.
|
(including unlocking) is forbidden by any flag or condition.
|
||||||
If parties contains 1 entry then noRipple is not a bar to xfer.
|
If parties contains 1 entry then noRipple is not a bar to xfer.
|
||||||
If parties contains more than 1 entry then any party with noRipple on issuer
|
If parties contains more than 1 entry then any party with noRipple
|
||||||
side is a bar to xfer.
|
on issuer side is a bar to xfer.
|
||||||
*/
|
*/
|
||||||
template<class V>
|
template<class V>
|
||||||
[[nodiscard]]TER
|
[[nodiscard]]TER
|
||||||
@@ -775,31 +775,30 @@ trustTransferLockedBalance(
|
|||||||
return tecUNFUNDED_PAYMENT;
|
return tecUNFUNDED_PAYMENT;
|
||||||
}
|
}
|
||||||
|
|
||||||
STAmount lockedBalance = sleSrcLine->getFieldAmount(sfLockedBalance);
|
|
||||||
|
|
||||||
// check they have sufficient funds
|
|
||||||
if (amount > lockedBalance)
|
|
||||||
{
|
|
||||||
JLOG(j.trace())
|
|
||||||
<< "trustTransferLockedBalance amount > lockedBalance: "
|
|
||||||
<< "amount=" << amount << " lockedBalance=" << lockedBalance;
|
|
||||||
return tecUNFUNDED_PAYMENT;
|
|
||||||
}
|
|
||||||
|
|
||||||
// decrement source balance
|
// decrement source balance
|
||||||
{
|
{
|
||||||
STAmount priorBalance =
|
STAmount priorBalance =
|
||||||
srcHigh ? -((*sleSrcLine)[sfBalance]) : (*sleSrcLine)[sfBalance];
|
srcHigh ? -((*sleSrcLine)[sfBalance]) : (*sleSrcLine)[sfBalance];
|
||||||
|
|
||||||
// ensure the currency/issuer in the locked balance matches the xfer amount
|
|
||||||
if (priorBalance.getIssuer() != issuerAccID || priorBalance.getCurrency() != currency)
|
|
||||||
return tecNO_PERMISSION;
|
|
||||||
|
|
||||||
STAmount finalBalance = priorBalance - amount;
|
|
||||||
|
|
||||||
STAmount priorLockedBalance =
|
STAmount priorLockedBalance =
|
||||||
srcHigh ? -((*sleSrcLine)[sfLockedBalance]) : (*sleSrcLine)[sfLockedBalance];
|
srcHigh ? -((*sleSrcLine)[sfLockedBalance]) : (*sleSrcLine)[sfLockedBalance];
|
||||||
|
|
||||||
|
AccountID srcIssuerAccID =
|
||||||
|
sleSrcLine->getFieldAmount(srcHigh ? sfLowLimit : sfHighLimit).getIssuer();
|
||||||
|
|
||||||
|
// check they have sufficient funds
|
||||||
|
if (amount > priorLockedBalance)
|
||||||
|
{
|
||||||
|
JLOG(j.trace())
|
||||||
|
<< "trustTransferLockedBalance amount > lockedBalance: "
|
||||||
|
<< "amount=" << amount << " lockedBalance="
|
||||||
|
<< priorLockedBalance;
|
||||||
|
return tecUNFUNDED_PAYMENT;
|
||||||
|
}
|
||||||
|
|
||||||
|
STAmount finalBalance = priorBalance - amount;
|
||||||
|
|
||||||
STAmount finalLockedBalance = priorLockedBalance - amount;
|
STAmount finalLockedBalance = priorLockedBalance - amount;
|
||||||
|
|
||||||
// this should never happen but defensively check it here before updating sle
|
// this should never happen but defensively check it here before updating sle
|
||||||
|
|||||||
Reference in New Issue
Block a user