From 4ae13f2bea29b86fa020db4079d8a578856413c1 Mon Sep 17 00:00:00 2001 From: Richard Holland Date: Wed, 12 Jul 2023 08:13:34 +0000 Subject: [PATCH] guard changes with HooksUpdate1 amendment --- src/ripple/app/hook/impl/applyHook.cpp | 2 +- src/ripple/app/tx/impl/Import.cpp | 16 +++++++++++----- 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/src/ripple/app/hook/impl/applyHook.cpp b/src/ripple/app/hook/impl/applyHook.cpp index a073b8466..e4524a6c2 100644 --- a/src/ripple/app/hook/impl/applyHook.cpp +++ b/src/ripple/app/hook/impl/applyHook.cpp @@ -1824,7 +1824,7 @@ finalizeHookResult( } // if any txns were emitted then add them to the HookEmissions - if (!emission_txnid.empty()) + if (applyCtx.view().rules().enabled(featureHooksUpdate1) && !emission_txnid.empty()) { for (auto const& etxnid : emission_txnid) { diff --git a/src/ripple/app/tx/impl/Import.cpp b/src/ripple/app/tx/impl/Import.cpp index 74d1782af..4f7c377d0 100644 --- a/src/ripple/app/tx/impl/Import.cpp +++ b/src/ripple/app/tx/impl/Import.cpp @@ -126,6 +126,9 @@ Import::preflight(PreflightContext const& ctx) if (!ctx.rules.enabled(featureImport)) return temDISABLED; + if (!ctx.rules.enabled(featureHooksUpdate1) && ctx.tx.isFieldPresent(sfIssuer)) + return temDISABLED; + if (auto const ret = preflight1(ctx); !isTesSuccess(ret)) return ret; @@ -1164,11 +1167,14 @@ Import::doApply() XRPAmount Import::calculateBaseFee(ReadView const& view, STTx const& tx) { - return - !view.exists(keylet::account(tx.getAccountID(sfAccount))) && - !tx.isFieldPresent(sfIssuer) - ? XRPAmount { 0 } - : Transactor::calculateBaseFee(view, tx); + if (!view.rules().enabled(featureHooksUpdate1)) + return XRPAmount { 0 }; + + if (!view.exists(keylet::account(tx.getAccountID(sfAccount))) && + !tx.isFieldPresent(sfIssuer)) + return XRPAmount { 0 }; + + return Transactor::calculateBaseFee(view, tx); } } // namespace ripple