From b75b9f2a7181198a5f10d6e933b050ecd1cd3175 Mon Sep 17 00:00:00 2001 From: Richard Holland Date: Mon, 20 Feb 2023 11:17:13 +0000 Subject: [PATCH] fix for #24 --- src/ripple/app/hook/impl/applyHook.cpp | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/ripple/app/hook/impl/applyHook.cpp b/src/ripple/app/hook/impl/applyHook.cpp index a5fbc74dd..73947ce80 100644 --- a/src/ripple/app/hook/impl/applyHook.cpp +++ b/src/ripple/app/hook/impl/applyHook.cpp @@ -3168,13 +3168,19 @@ DEFINE_HOOK_FUNCTION( } // rule 5: LastLedgerSeq must be present and after current ledger + if (!stpTrans->isFieldPresent(sfLastLedgerSequence)) + { + JLOG(j.trace()) + << "HookEmit[" << HC_ACC() << "]: sfLastLedgerSequence missing"; + return EMISSION_FAILURE; + } uint32_t tx_lls = stpTrans->getFieldU32(sfLastLedgerSequence); uint32_t ledgerSeq = applyCtx.app.getLedgerMaster().getValidLedgerIndex() + 1; - if (!stpTrans->isFieldPresent(sfLastLedgerSequence) || tx_lls < ledgerSeq + 1) + if (tx_lls < ledgerSeq + 1) { JLOG(j.trace()) - << "HookEmit[" << HC_ACC() << "]: sfLastLedgerSequence missing or invalid"; + << "HookEmit[" << HC_ACC() << "]: sfLastLedgerSequence invalid (less than next ledger)"; return EMISSION_FAILURE; }