test: move SEQUENCE_LOCKTIME flags to script
What changed, and why it matters
This commit is a minor test-code cleanup. It moves four named constants related to BIP68 sequence locktime rules from one test file into the shared test framework library. No production code, consensus rules, or security behavior is changed.
No action required. This is a non-security test refactor.
Security signals we found
No strong security signals were identified.
Evidence from the diff
The diff removes local definitions of SEQUENCE_LOCKTIME_DISABLE_FLAG, SEQUENCE_LOCKTIME_TYPE_FLAG, SEQUENCE_LOCKTIME_GRANULARITY, and SEQUENCE_LOCKTIME_MASK from test/functional/feature_bip68_sequence.py and adds identical definitions to test/functional/test_framework/script.py. The values are unchanged and the constants are re-imported by the test. This is purely a refactor of the functional test suite.
Changed components
test/functional/feature_bip68_sequence.pytest/functional/test_framework/script.pyInspect captured patch +9 / −5
diff --git a/test/functional/feature_bip68_sequence.py b/test/functional/feature_bip68_sequence.py
index 2f54183f..ac2d56fb 100755
--- a/test/functional/feature_bip68_sequence.py
+++ b/test/functional/feature_bip68_sequence.py
@@ -24,6 +24,10 @@ from test_framework.messages import (
from test_framework.script import (
CScript,
OP_TRUE,
+ SEQUENCE_LOCKTIME_DISABLE_FLAG,
+ SEQUENCE_LOCKTIME_TYPE_FLAG,
+ SEQUENCE_LOCKTIME_GRANULARITY,
+ SEQUENCE_LOCKTIME_MASK,
)
from test_framework.test_framework import BitcoinTestFramework
from test_framework.util import (
@@ -36,11 +40,6 @@ from test_framework.wallet import MiniWallet
SCRIPT_W0_SH_OP_TRUE = script_to_p2wsh_script(CScript([OP_TRUE]))
-SEQUENCE_LOCKTIME_DISABLE_FLAG = (1<<31)
-SEQUENCE_LOCKTIME_TYPE_FLAG = (1<<22) # this means use time (0 means height)
-SEQUENCE_LOCKTIME_GRANULARITY = 9 # this is a bit-shift
-SEQUENCE_LOCKTIME_MASK = 0x0000ffff
-
# RPC error for non-BIP68 final transactions
NOT_FINAL_ERROR = "non-BIP68-final"
diff --git a/test/functional/test_framework/script.py b/test/functional/test_framework/script.py
index 369bd2d7..9386064f 100644
--- a/test/functional/test_framework/script.py
+++ b/test/functional/test_framework/script.py
@@ -28,6 +28,11 @@ MAX_PUBKEYS_PER_MULTI_A = 999
LOCKTIME_THRESHOLD = 500000000
ANNEX_TAG = 0x50
+SEQUENCE_LOCKTIME_DISABLE_FLAG = (1<<31)
+SEQUENCE_LOCKTIME_TYPE_FLAG = (1<<22) # this means use time (0 means height)
+SEQUENCE_LOCKTIME_GRANULARITY = 9 # this is a bit-shift
+SEQUENCE_LOCKTIME_MASK = 0x0000ffff
+
LEAF_VERSION_TAPSCRIPT = 0xc0
def hash160(s):
Why this scored 15/100
Community notes
Notes can correct, qualify, or add evidence to the AI analysis. Every note shown here has been validated by a human moderator.
The AI analysis stands alone for now. Submit a note if you can add evidence or important context.