mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-07-28 16:22:41 +02:00
test: refactor: add constant for sequence number SEQUENCE_FINAL
This commit is contained in:
@@ -13,6 +13,7 @@ from test_framework.blocktools import (
|
||||
)
|
||||
from test_framework.messages import (
|
||||
CTransaction,
|
||||
SEQUENCE_FINAL,
|
||||
msg_block,
|
||||
)
|
||||
from test_framework.p2p import P2PInterface
|
||||
@@ -53,7 +54,7 @@ def cltv_invalidate(tx, failure_reason):
|
||||
# 3) the lock-time type (height vs. timestamp) of the top stack item and the
|
||||
# nLockTime field are not the same
|
||||
# 4) the top stack item is greater than the transaction's nLockTime field
|
||||
# 5) the nSequence field of the txin is 0xffffffff
|
||||
# 5) the nSequence field of the txin is 0xffffffff (SEQUENCE_FINAL)
|
||||
assert failure_reason in range(5)
|
||||
scheme = [
|
||||
# | Script to prepend to scriptSig | nSequence | nLockTime |
|
||||
@@ -62,7 +63,7 @@ def cltv_invalidate(tx, failure_reason):
|
||||
[[OP_1NEGATE, OP_CHECKLOCKTIMEVERIFY, OP_DROP], None, None],
|
||||
[[CScriptNum(100), OP_CHECKLOCKTIMEVERIFY, OP_DROP], 0, 1296688602], # timestamp of genesis block
|
||||
[[CScriptNum(100), OP_CHECKLOCKTIMEVERIFY, OP_DROP], 0, 50],
|
||||
[[CScriptNum(50), OP_CHECKLOCKTIMEVERIFY, OP_DROP], 0xffffffff, 50],
|
||||
[[CScriptNum(50), OP_CHECKLOCKTIMEVERIFY, OP_DROP], SEQUENCE_FINAL, 50],
|
||||
][failure_reason]
|
||||
|
||||
cltv_modify_tx(tx, prepend_scriptsig=scheme[0], nsequence=scheme[1], nlocktime=scheme[2])
|
||||
|
Reference in New Issue
Block a user