mirror of
https://github.com/Xahau/xahaud.git
synced 2026-04-29 15:37:46 +00:00
fix bug in iouescrow, hook macro
This commit is contained in:
@@ -224,7 +224,7 @@ int out_len = 0;\
|
||||
|
||||
|
||||
#define INT64_FROM_BUF(buf)\
|
||||
((((uint64_t)((buf)[0]&7FU) << 56) +\
|
||||
((((uint64_t)((buf)[0] & 0x7FU) << 56) +\
|
||||
((uint64_t)((buf)[1]) << 48) +\
|
||||
((uint64_t)((buf)[2]) << 40) +\
|
||||
((uint64_t)((buf)[3]) << 32) +\
|
||||
|
||||
@@ -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 =
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user