From 6c8746cbf3ba2e47e7451f6ba02344acbd009dcd Mon Sep 17 00:00:00 2001 From: Mayukha Vadari Date: Mon, 29 Jun 2026 20:07:58 -0400 Subject: [PATCH] clean up --- include/xrpl/ledger/ApplyView.h | 6 ++++++ include/xrpl/tx/ApplyContext.h | 2 +- src/libxrpl/tx/transactors/check/CheckCash.cpp | 5 +---- 3 files changed, 8 insertions(+), 5 deletions(-) diff --git a/include/xrpl/ledger/ApplyView.h b/include/xrpl/ledger/ApplyView.h index 7937bd330e..7045664ebd 100644 --- a/include/xrpl/ledger/ApplyView.h +++ b/include/xrpl/ledger/ApplyView.h @@ -445,6 +445,12 @@ struct ApplyViewContext ApplyView& view; STTx const& tx; ReserveContext reserveContext; + + static ApplyViewContext + makeFromTx(ApplyView& view, STTx const& tx) + { + return {.view = view, .tx = tx, .reserveContext = ReserveContext::makeFromTx(view, tx)}; + } }; namespace directory { diff --git a/include/xrpl/tx/ApplyContext.h b/include/xrpl/tx/ApplyContext.h index e52b28d9a5..373e2f8853 100644 --- a/include/xrpl/tx/ApplyContext.h +++ b/include/xrpl/tx/ApplyContext.h @@ -116,7 +116,7 @@ public: getApplyViewContext() { XRPL_ASSERT(view_.has_value(), "Previous view exists"); - return {.view = *view_, .tx = tx, .reserveContext = ReserveContext::makeFromTx(*view_, tx)}; + return ApplyViewContext::makeFromTx(*view_, tx); } private: diff --git a/src/libxrpl/tx/transactors/check/CheckCash.cpp b/src/libxrpl/tx/transactors/check/CheckCash.cpp index bc3200ea1d..d9e0c8953a 100644 --- a/src/libxrpl/tx/transactors/check/CheckCash.cpp +++ b/src/libxrpl/tx/transactors/check/CheckCash.cpp @@ -390,10 +390,7 @@ CheckCash::doApply() STAmount const flowDeliver{ optDeliverMin ? maxDeliverMin() : ctx_.tx.getFieldAmount(sfAmount)}; - auto applyViewContext = ApplyViewContext( - {.view = psb, - .tx = ctx_.tx, - .reserveContext = ReserveContext::makeFromTx(psb, ctx_.tx)}); + auto applyViewContext = ApplyViewContext::makeFromTx(psb, ctx_.tx); auto const sponsorSle = applyViewContext.reserveContext.sponsorSle; // Check reserve. Return destination account SLE if enough reserve,