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,