fix no-line bug

This commit is contained in:
dangell7
2023-01-23 03:14:26 -05:00
parent 14c68f88ea
commit 3cf5a3d3d1
2 changed files with 12 additions and 11 deletions

View File

@@ -236,11 +236,6 @@ EscrowCreate::doApply()
if (!ctx_.view().rules().enabled(featurePaychanAndEscrowForTokens)) if (!ctx_.view().rules().enabled(featurePaychanAndEscrowForTokens))
return temDISABLED; return temDISABLED;
// check if the escrow is capable of being
// finished before we allow it to be created
if (!sleLine && amount.getIssuer() != account)
return tecNO_LINE;
TER result = trustTransferAllowed( TER result = trustTransferAllowed(
ctx_.view(), ctx_.view(),
{account, ctx_.tx[sfDestination]}, {account, ctx_.tx[sfDestination]},
@@ -255,12 +250,17 @@ EscrowCreate::doApply()
// issuer does not need to lock anything // issuer does not need to lock anything
if (!isIssuer) if (!isIssuer)
{ {
// perform the lock as a dry run before // perform the lock as a dry run before
// we modify anything on-ledger // we modify anything on-ledger
sleLine = ctx_.view().peek(keylet::line( sleLine = ctx_.view().peek(keylet::line(
account, amount.getIssuer(), amount.getCurrency())); account, amount.getIssuer(), amount.getCurrency()));
// check if the escrow is capable of being
// finished before we allow it to be created
if (!sleLine)
return tecNO_LINE;
{ {
TER result = trustAdjustLockedBalance( TER result = trustAdjustLockedBalance(
ctx_.view(), sleLine, amount, 1, ctx_.journal, DryRun); ctx_.view(), sleLine, amount, 1, ctx_.journal, DryRun);
@@ -336,12 +336,12 @@ EscrowCreate::doApply()
if (!ctx_.view().rules().enabled(featurePaychanAndEscrowForTokens)) if (!ctx_.view().rules().enabled(featurePaychanAndEscrowForTokens))
return temDISABLED; return temDISABLED;
if (!sleLine && amount.getIssuer() != account)
return tecNO_LINE;
// issuer does not need to lock anything // issuer does not need to lock anything
if (!isIssuer) if (!isIssuer)
{ {
if (!sleLine)
return tecNO_LINE;
// do the lock-up for real now // do the lock-up for real now
TER result = trustAdjustLockedBalance( TER result = trustAdjustLockedBalance(
ctx_.view(), sleLine, amount, 1, ctx_.journal, WetRun); ctx_.view(), sleLine, amount, 1, ctx_.journal, WetRun);

View File

@@ -383,11 +383,12 @@ PayChanCreate::doApply()
auto sleLine = ctx_.view().peek( auto sleLine = ctx_.view().peek(
keylet::line(account, amount.getIssuer(), amount.getCurrency())); keylet::line(account, amount.getIssuer(), amount.getCurrency()));
if (!sleLine && !isIssuer)
return tecNO_LINE;
if (!isIssuer) if (!isIssuer)
{ {
if (!sleLine)
return tecNO_LINE;
TER result = trustAdjustLockedBalance( TER result = trustAdjustLockedBalance(
ctx_.view(), sleLine, amount, 1, ctx_.journal, WetRun); ctx_.view(), sleLine, amount, 1, ctx_.journal, WetRun);