From 5f913b589741dafb18cd60a09b4e209af267f7a0 Mon Sep 17 00:00:00 2001 From: Richard Holland Date: Tue, 17 Jan 2023 11:28:15 +0000 Subject: [PATCH] more todo cleanup --- src/ripple/app/hook/impl/applyHook.cpp | 10 ++++++++-- src/ripple/overlay/impl/PeerImp.cpp | 4 ++-- src/ripple/rpc/handlers/LedgerHandler.cpp | 2 +- 3 files changed, 11 insertions(+), 5 deletions(-) diff --git a/src/ripple/app/hook/impl/applyHook.cpp b/src/ripple/app/hook/impl/applyHook.cpp index 885204987..a04c1e0ac 100644 --- a/src/ripple/app/hook/impl/applyHook.cpp +++ b/src/ripple/app/hook/impl/applyHook.cpp @@ -647,8 +647,6 @@ unserialize_keylet(uint8_t* ptr, uint32_t len) } -// RH TODO: this is used by sethook to determine the value stored in ltHOOK -// replace this with votable value uint32_t hook::maxHookStateDataSize(void) { return 256U; } @@ -2877,6 +2875,7 @@ DEFINE_HOOK_FUNCTION( // check the emitted txn is valid /* Emitted TXN rules + * 0. Account must match the hook account * 1. Sequence: 0 * 2. PubSigningKey: 000000000000000 * 3. sfEmitDetails present and valid @@ -2887,6 +2886,13 @@ DEFINE_HOOK_FUNCTION( * 8. The generation cannot be higher than 10 */ + // rule 0: account must match the hook account + if (!stpTrans->isFieldPresent(sfAccount) || stpTrans->getAccountID(sfAccount) != hookCtx.result.account) + { + JLOG(j.trace()) + << "HookEmit[" << HC_ACC() << "]: sfAccount does not match hook account"; + return EMISSION_FAILURE; + } // rule 1: sfSequence must be present and 0 if (!stpTrans->isFieldPresent(sfSequence) || stpTrans->getFieldU32(sfSequence) != 0) diff --git a/src/ripple/overlay/impl/PeerImp.cpp b/src/ripple/overlay/impl/PeerImp.cpp index 0fef57d9b..146a139a7 100644 --- a/src/ripple/overlay/impl/PeerImp.cpp +++ b/src/ripple/overlay/impl/PeerImp.cpp @@ -1546,8 +1546,8 @@ PeerImp::handleTransaction( if (stx->isFieldPresent(sfEmitDetails)) { JLOG(p_journal_.warn()) << "Ignoring Network relayed Tx containing sfEmitDetails (handleTransaction)."; - //fee_ = Resource::feeHighBurdenPeer; // RH TODO: enable when relay bug is fixed - //return; + //fee_ = Resource::feeHighBurdenPeer; // RH TODO: fix + return; } int flags; diff --git a/src/ripple/rpc/handlers/LedgerHandler.cpp b/src/ripple/rpc/handlers/LedgerHandler.cpp index 7d20fd70e..8b5a6d410 100644 --- a/src/ripple/rpc/handlers/LedgerHandler.cpp +++ b/src/ripple/rpc/handlers/LedgerHandler.cpp @@ -74,7 +74,7 @@ LedgerHandler::check() // Until some sane way to get full ledgers has been implemented, // disallow retrieving all state nodes. - uint32_t nodeNID = ctx.app.config().NETWORK_ID; + uint32_t nodeNID = context_.app.config().NETWORK_ID; if (nodeNID == 21337) { // RH NOTE: production network requires rpc permission to dump full ledger