diff --git a/src/ripple/app/tx/impl/SetHook.cpp b/src/ripple/app/tx/impl/SetHook.cpp index efc8199fe..ac3e9fb44 100644 --- a/src/ripple/app/tx/impl/SetHook.cpp +++ b/src/ripple/app/tx/impl/SetHook.cpp @@ -431,6 +431,14 @@ SetHook::validateHookSetEntry(SetHookCtx& ctx, STObject const& hookSetObj) } auto version = hookSetObj.getFieldU16(sfHookApiVersion); + if (!ctx.rules.enabled(featureHooksV1) && version == 1) + { + JLOG(ctx.j.trace()) + << "HookSet(" << hook::log::API_INVALID << ")[" << HS_ACC() + << "]: Malformed transaction: SetHook " + "sfHook->sfHookApiVersion invalid. (HooksV1 not enabled)."; + return false; + } if (version > 1) { // we currently only accept api version 0 and 1 diff --git a/src/ripple/protocol/Feature.h b/src/ripple/protocol/Feature.h index 2d46df876..292319827 100644 --- a/src/ripple/protocol/Feature.h +++ b/src/ripple/protocol/Feature.h @@ -74,7 +74,7 @@ namespace detail { // Feature.cpp. Because it's only used to reserve storage, and determine how // large to make the FeatureBitset, it MAY be larger. It MUST NOT be less than // the actual number of amendments. A LogicError on startup will verify this. -static constexpr std::size_t numFeatures = 70; +static constexpr std::size_t numFeatures = 71; /** Amendments that this server supports and the default voting behavior. Whether they are enabled depends on the Rules defined in the validated @@ -358,6 +358,7 @@ extern uint256 const fixXahauV2; extern uint256 const featureRemit; extern uint256 const featureZeroB2M; extern uint256 const fixNSDelete; +extern uint256 const featureHooksV1; } // namespace ripple diff --git a/src/ripple/protocol/impl/Feature.cpp b/src/ripple/protocol/impl/Feature.cpp index 9cf82e316..11fd3344a 100644 --- a/src/ripple/protocol/impl/Feature.cpp +++ b/src/ripple/protocol/impl/Feature.cpp @@ -464,6 +464,7 @@ REGISTER_FIX (fixXahauV2, Supported::yes, VoteBehavior::De REGISTER_FEATURE(Remit, Supported::yes, VoteBehavior::DefaultNo); REGISTER_FEATURE(ZeroB2M, Supported::yes, VoteBehavior::DefaultNo); REGISTER_FIX (fixNSDelete, Supported::yes, VoteBehavior::DefaultNo); +REGISTER_FEATURE(HooksV1, Supported::yes, VoteBehavior::DefaultNo); // The following amendments are obsolete, but must remain supported // because they could potentially get enabled.