add feature

This commit is contained in:
Denis Angell
2024-07-30 12:17:00 +02:00
parent c1610a6dda
commit 783bff75a0
3 changed files with 11 additions and 1 deletions

View File

@@ -431,6 +431,14 @@ SetHook::validateHookSetEntry(SetHookCtx& ctx, STObject const& hookSetObj)
} }
auto version = hookSetObj.getFieldU16(sfHookApiVersion); 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) if (version > 1)
{ {
// we currently only accept api version 0 and 1 // we currently only accept api version 0 and 1

View File

@@ -74,7 +74,7 @@ namespace detail {
// Feature.cpp. Because it's only used to reserve storage, and determine how // 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 // 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. // 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. /** Amendments that this server supports and the default voting behavior.
Whether they are enabled depends on the Rules defined in the validated 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 featureRemit;
extern uint256 const featureZeroB2M; extern uint256 const featureZeroB2M;
extern uint256 const fixNSDelete; extern uint256 const fixNSDelete;
extern uint256 const featureHooksV1;
} // namespace ripple } // namespace ripple

View File

@@ -464,6 +464,7 @@ REGISTER_FIX (fixXahauV2, Supported::yes, VoteBehavior::De
REGISTER_FEATURE(Remit, Supported::yes, VoteBehavior::DefaultNo); REGISTER_FEATURE(Remit, Supported::yes, VoteBehavior::DefaultNo);
REGISTER_FEATURE(ZeroB2M, Supported::yes, VoteBehavior::DefaultNo); REGISTER_FEATURE(ZeroB2M, Supported::yes, VoteBehavior::DefaultNo);
REGISTER_FIX (fixNSDelete, 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 // The following amendments are obsolete, but must remain supported
// because they could potentially get enabled. // because they could potentially get enabled.