mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-07-04 12:42:05 +02:00
Merge #20165: Only relay Taproot spends if next block has it active
3d0556d410
Increase feature_taproot inactive test coverage (Pieter Wuille)525cbd425e
Only relay Taproot spends if next block has it active (Pieter Wuille) Pull request description: There should be no change to mempool transaction behavior for witness v1 transactions as long as no activation is defined. Until that point, we should treat the consensus rules as under debate, and for soft-fork safety, that means spends should be treated as non-standard. It's possible to go further: don't relay them unless the consensus rules are actually active for the next block. This extends non-relay to the period where a deployment is defined, started, locked in, or failed. I see no downsides to this, and the code change is very simple. ACKs for top commit: Sjors: utACK3d0556d410
MarcoFalke: review ACK3d0556d410
🏓 jnewbery: utACK3d0556d410
Tree-SHA512: ca625a2981716b4b44e8f3722718fd25fd04e25bf3ca1684924b8974fca49f7c1d438fdd9dcdfbc091a442002e20d441d42c41a0e2096e74a61068da6c60267a
This commit is contained in:
@ -1129,13 +1129,13 @@ def spenders_taproot_inactive():
|
||||
]
|
||||
tap = taproot_construct(pub, scripts)
|
||||
|
||||
# Test that keypath spending is valid & standard if compliant, but valid and nonstandard otherwise.
|
||||
add_spender(spenders, "inactive/keypath_valid", key=sec, tap=tap)
|
||||
# Test that keypath spending is valid & non-standard, regardless of validity.
|
||||
add_spender(spenders, "inactive/keypath_valid", key=sec, tap=tap, standard=False)
|
||||
add_spender(spenders, "inactive/keypath_invalidsig", key=sec, tap=tap, standard=False, sighash=bitflipper(default_sighash))
|
||||
add_spender(spenders, "inactive/keypath_empty", key=sec, tap=tap, standard=False, witness=[])
|
||||
|
||||
# Same for scriptpath spending (but using future features like annex, leaf versions, or OP_SUCCESS is nonstandard).
|
||||
add_spender(spenders, "inactive/scriptpath_valid", key=sec, tap=tap, leaf="pk", inputs=[getter("sign")])
|
||||
# Same for scriptpath spending (and features like annex, leaf versions, or OP_SUCCESS don't change this)
|
||||
add_spender(spenders, "inactive/scriptpath_valid", key=sec, tap=tap, leaf="pk", standard=False, inputs=[getter("sign")])
|
||||
add_spender(spenders, "inactive/scriptpath_invalidsig", key=sec, tap=tap, leaf="pk", standard=False, inputs=[getter("sign")], sighash=bitflipper(default_sighash))
|
||||
add_spender(spenders, "inactive/scriptpath_invalidcb", key=sec, tap=tap, leaf="pk", standard=False, inputs=[getter("sign")], controlblock=bitflipper(default_controlblock))
|
||||
add_spender(spenders, "inactive/scriptpath_valid_unkleaf", key=sec, tap=tap, leaf="future_leaf", standard=False, inputs=[getter("sign")])
|
||||
@ -1451,7 +1451,11 @@ class TaprootTest(BitcoinTestFramework):
|
||||
|
||||
# Pre-taproot activation tests.
|
||||
self.log.info("Pre-activation tests...")
|
||||
self.test_spenders(self.nodes[0], spenders_taproot_inactive(), input_counts=[1, 2, 2, 2, 2, 3])
|
||||
# Run each test twice; once in isolation, and once combined with others. Testing in isolation
|
||||
# means that the standardness is verified in every test (as combined transactions are only standard
|
||||
# when all their inputs are standard).
|
||||
self.test_spenders(self.nodes[0], spenders_taproot_inactive(), input_counts=[1])
|
||||
self.test_spenders(self.nodes[0], spenders_taproot_inactive(), input_counts=[2, 3])
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
|
Reference in New Issue
Block a user