From 7abfc033c06ca15ae2e99ed49a6f0affe8f51f14 Mon Sep 17 00:00:00 2001 From: Richard Holland Date: Tue, 7 Mar 2023 14:06:54 +0000 Subject: [PATCH] fix for #38 --- src/ripple/app/hook/Enum.h | 1 + src/ripple/app/tx/impl/SetHook.cpp | 8 +++++++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/src/ripple/app/hook/Enum.h b/src/ripple/app/hook/Enum.h index f5882938b06..25196412e3e 100644 --- a/src/ripple/app/hook/Enum.h +++ b/src/ripple/app/hook/Enum.h @@ -132,6 +132,7 @@ namespace hook NESTING_LIMIT = 84, // the hook nested blocks/loops/ifs beyond 16 levels SECTIONS_OUT_OF_SEQUENCE = 85, // the wasm contained sections out of sequence CUSTOM_SECTION_DISALLOWED = 86, // the wasm contained a custom section (id=0) + INTERNAL_ERROR = 87, // an internal error described by the log text // RH NOTE: only HookSet msgs got log codes, possibly all Hook log lines should get a code? }; }; diff --git a/src/ripple/app/tx/impl/SetHook.cpp b/src/ripple/app/tx/impl/SetHook.cpp index bfc07f93160..7893016de6a 100644 --- a/src/ripple/app/tx/impl/SetHook.cpp +++ b/src/ripple/app/tx/impl/SetHook.cpp @@ -1260,7 +1260,13 @@ SetHook::setHook() // if there is only an existing hook, without a HookSetObj then it is // logically impossible for the operation to not be NOOP - assert(hookSetObj || op == hsoNOOP); + if(!hookSetObj && op != hsoNOOP) + { + JLOG(ctx.j.warn()) + << "HookSet(" << hook::log::INTERNAL_ERROR << ")[" << HS_ACC() + << "]: Logic error. !hookSetObj && op != hsoNOOP"; + return tecINTERNAL; + } switch (op) {