diff --git a/src/ripple/app/tx/impl/PayChan.cpp b/src/ripple/app/tx/impl/PayChan.cpp index a347eacffa1..280a9b7b480 100644 --- a/src/ripple/app/tx/impl/PayChan.cpp +++ b/src/ripple/app/tx/impl/PayChan.cpp @@ -248,6 +248,13 @@ PayChanCreate::doApply() if (!sle) return tefINTERNAL; + if (ctx_.view().rules().enabled(fixPayChanCancelAfter)) + { + auto const closeTime = ctx_.view().info().parentCloseTime; + if (ctx_.tx[~sfCancelAfter] && after(closeTime, ctx_.tx[sfCancelAfter])) + return tecEXPIRED; + } + auto const dst = ctx_.tx[sfDestination]; // Create PayChan in ledger. @@ -270,13 +277,6 @@ PayChanCreate::doApply() (*slep)[~sfSourceTag] = ctx_.tx[~sfSourceTag]; (*slep)[~sfDestinationTag] = ctx_.tx[~sfDestinationTag]; - if (ctx_.view().rules().enabled(fixPayChanCancelAfter)) - { - auto const closeTime = ctx_.view().info().parentCloseTime; - if (ctx_.tx[~sfCancelAfter] && after(closeTime, ctx_.tx[sfCancelAfter])) - return tecEXPIRED; - } - ctx_.view().insert(slep); // Add PayChan to owner directory