From 4c20343b4d318be62086676e0898e56221500de1 Mon Sep 17 00:00:00 2001 From: Bue-von-hon Date: Sat, 26 Apr 2025 10:32:30 +0900 Subject: [PATCH] rpc: Add transaction min standard version parameter --- src/policy/policy.cpp | 2 +- src/policy/policy.h | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/src/policy/policy.cpp b/src/policy/policy.cpp index fdb6bc5f34..3da6cb7489 100644 --- a/src/policy/policy.cpp +++ b/src/policy/policy.cpp @@ -98,7 +98,7 @@ bool IsStandard(const CScript& scriptPubKey, TxoutType& whichType) bool IsStandardTx(const CTransaction& tx, const std::optional& max_datacarrier_bytes, bool permit_bare_multisig, const CFeeRate& dust_relay_fee, std::string& reason) { - if (tx.version > TX_MAX_STANDARD_VERSION || tx.version < 1) { + if (tx.version > TX_MAX_STANDARD_VERSION || tx.version < TX_MIN_STANDARD_VERSION) { reason = "version"; return false; } diff --git a/src/policy/policy.h b/src/policy/policy.h index ce8bfc6aef..23993dd705 100644 --- a/src/policy/policy.h +++ b/src/policy/policy.h @@ -145,6 +145,7 @@ std::vector GetDust(const CTransaction& tx, CFeeRate dust_relay_rate); // Changing the default transaction version requires a two step process: first // adapting relay policy by bumping TX_MAX_STANDARD_VERSION, and then later // allowing the new transaction version in the wallet/RPC. +static constexpr decltype(CTransaction::version) TX_MIN_STANDARD_VERSION{1}; static constexpr decltype(CTransaction::version) TX_MAX_STANDARD_VERSION{3}; /**