fix bug in iouescrow, hook macro

This commit is contained in:
Richard Holland
2022-06-14 12:52:55 +00:00
parent 2793f25acc
commit d3f6c4ef2d
3 changed files with 15 additions and 3 deletions

View File

@@ -261,6 +261,15 @@ EscrowCreate::doApply()
// perform the lock as a dry run before
// we modify anything on-ledger
sleLine = ctx_.view().peek(keylet::line(account, amount.getIssuer(), amount.getCurrency()));
if (!sleLine)
{
JLOG(ctx_.journal.trace())
<< "EscrowCreate::doApply trustAdjustLockedBalance trustline missing "
<< account << "-"
<< amount.getIssuer() << "/"
<< amount.getCurrency();
return tecUNFUNDED;
}
{
TER result =

View File

@@ -494,6 +494,9 @@ trustAdjustLockedBalance(
if (!view.rules().enabled(featurePaychanAndEscrowForTokens))
return tefINTERNAL;
if (!sleLine)
return tecINTERNAL;
auto const currency = deltaAmt.getCurrency();
auto const issuer = deltaAmt.getIssuer();
@@ -989,12 +992,12 @@ trustTransferLockedBalance(
STAmount priorBalance =
dstHigh ? -((*sleDstLine)[sfBalance]) : (*sleDstLine)[sfBalance];
STAmount finalBalance = priorBalance + (flipDstAmt ? -dstAmt : dstAmt);
STAmount finalBalance = priorBalance + dstAmt;
if (finalBalance < priorBalance)
{
JLOG(j.warn())
<< "trustTransferLockedBalance resulted in a lower final balance on dest line";
<< "trustTransferLockedBalance resulted in a lower/equal final balance on dest line";
return tecINTERNAL;
}