From 82ede27f1020f380e44beade2f19bef75490b98b Mon Sep 17 00:00:00 2001 From: Denis Angell Date: Sun, 2 Aug 2026 15:55:54 -0400 Subject: [PATCH] style: construct unlock helper locals after early returns --- include/xrpl/ledger/helpers/EscrowHelpers.h | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/include/xrpl/ledger/helpers/EscrowHelpers.h b/include/xrpl/ledger/helpers/EscrowHelpers.h index 17e856a60e..c4854f9f6a 100644 --- a/include/xrpl/ledger/helpers/EscrowHelpers.h +++ b/include/xrpl/ledger/helpers/EscrowHelpers.h @@ -57,7 +57,7 @@ escrowLockPreclaimHelper( beast::Journal j) { auto const& issue = amount.get(); - AccountID const& issuer = amount.getIssuer(); + auto const& issuer = amount.getIssuer(); // If the issuer is the same as the account, return tecNO_PERMISSION if (issuer == account) return tecNO_PERMISSION; @@ -340,12 +340,8 @@ escrowUnlockApplyHelper( bool createAsset, beast::Journal journal) { - auto const& issue = amount.get(); - Keylet const trustLineKey = keylet::trustLine(receiver, issue); - bool const recvLow = issuer > receiver; bool const senderIssuer = issuer == sender; bool const receiverIssuer = issuer == receiver; - bool const lineExisted = ctx.view.exists(trustLineKey); if (senderIssuer) return tecINTERNAL; // LCOV_EXCL_LINE @@ -353,7 +349,11 @@ escrowUnlockApplyHelper( if (receiverIssuer) return tesSUCCESS; - if (!lineExisted && createAsset) + auto const& issue = amount.get(); + Keylet const trustLineKey = keylet::trustLine(receiver, issue); + bool const recvLow = issuer > receiver; + + if (!ctx.view.exists(trustLineKey) && createAsset) { // Can the account cover the trust line's reserve? auto const sponsorSle = getEffectiveTxReserveSponsor(ctx, sleDest);