From 3cf5a3d3d14d09bbf2e4c4a24247aad38d104f60 Mon Sep 17 00:00:00 2001 From: dangell7 Date: Mon, 23 Jan 2023 03:14:26 -0500 Subject: [PATCH] fix no-line bug --- src/ripple/app/tx/impl/Escrow.cpp | 18 +++++++++--------- src/ripple/app/tx/impl/PayChan.cpp | 5 +++-- 2 files changed, 12 insertions(+), 11 deletions(-) diff --git a/src/ripple/app/tx/impl/Escrow.cpp b/src/ripple/app/tx/impl/Escrow.cpp index ea7927125..df665a98b 100644 --- a/src/ripple/app/tx/impl/Escrow.cpp +++ b/src/ripple/app/tx/impl/Escrow.cpp @@ -236,11 +236,6 @@ EscrowCreate::doApply() if (!ctx_.view().rules().enabled(featurePaychanAndEscrowForTokens)) 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( ctx_.view(), {account, ctx_.tx[sfDestination]}, @@ -255,12 +250,17 @@ EscrowCreate::doApply() // issuer does not need to lock anything if (!isIssuer) - { + { // perform the lock as a dry run before // we modify anything on-ledger sleLine = ctx_.view().peek(keylet::line( 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( ctx_.view(), sleLine, amount, 1, ctx_.journal, DryRun); @@ -336,12 +336,12 @@ EscrowCreate::doApply() if (!ctx_.view().rules().enabled(featurePaychanAndEscrowForTokens)) return temDISABLED; - if (!sleLine && amount.getIssuer() != account) - return tecNO_LINE; - // issuer does not need to lock anything if (!isIssuer) { + if (!sleLine) + return tecNO_LINE; + // do the lock-up for real now TER result = trustAdjustLockedBalance( ctx_.view(), sleLine, amount, 1, ctx_.journal, WetRun); diff --git a/src/ripple/app/tx/impl/PayChan.cpp b/src/ripple/app/tx/impl/PayChan.cpp index df77d53dc..20e590d4f 100644 --- a/src/ripple/app/tx/impl/PayChan.cpp +++ b/src/ripple/app/tx/impl/PayChan.cpp @@ -383,11 +383,12 @@ PayChanCreate::doApply() auto sleLine = ctx_.view().peek( keylet::line(account, amount.getIssuer(), amount.getCurrency())); - if (!sleLine && !isIssuer) - return tecNO_LINE; if (!isIssuer) { + if (!sleLine) + return tecNO_LINE; + TER result = trustAdjustLockedBalance( ctx_.view(), sleLine, amount, 1, ctx_.journal, WetRun);