mirror of
https://github.com/bitcoin/bitcoin.git
synced 2024-11-20 02:25:40 +01:00
Merge #21081: test: fix the unreachable code at feature_taproot
5e0cd25e29
fix the unreachable code at feature_taproot (Bruno Garcia) Pull request description: This PR removes the unnecessary return statement at the beginning of the function that makes the rest of the function unreachable. ACKs for top commit: practicalswift: cr ACK5e0cd25e29
: patch looks correct! sipa: ACK5e0cd25e29
. theStack: Tested ACK5e0cd25e29
🏔️ sanket1729: tACK5e0cd25e29
. I noted this a while ago while fixing feature_taproot.py for elements. Verified that the extreme ranges of CScriptNum are correct and the overflow case for `CHECKSIGADD` works as intended. Adding 1 to 2^31 - 1 results in an overflow, but the interpreter puts a `vch` of corresponding to 2^31 on stack. Even though it cannot be converted to CscriptNum(restricted to 4 bytes), it's result can still be compared by OP_EQUAL. Tree-SHA512: fff9be3be94f4b3f3ccf24bf588d96e84d14806f82692dccd31631b0e5c79a7575a96c308cb5a4f610ab02e2f854b899f374437c33ecf6d52055d333f2de9b27
This commit is contained in:
commit
cf26ca3911
@ -517,7 +517,6 @@ def add_spender(spenders, *args, **kwargs):
|
|||||||
|
|
||||||
def random_checksig_style(pubkey):
|
def random_checksig_style(pubkey):
|
||||||
"""Creates a random CHECKSIG* tapscript that would succeed with only the valid signature on witness stack."""
|
"""Creates a random CHECKSIG* tapscript that would succeed with only the valid signature on witness stack."""
|
||||||
return bytes(CScript([pubkey, OP_CHECKSIG]))
|
|
||||||
opcode = random.choice([OP_CHECKSIG, OP_CHECKSIGVERIFY, OP_CHECKSIGADD])
|
opcode = random.choice([OP_CHECKSIG, OP_CHECKSIGVERIFY, OP_CHECKSIGADD])
|
||||||
if (opcode == OP_CHECKSIGVERIFY):
|
if (opcode == OP_CHECKSIGVERIFY):
|
||||||
ret = CScript([pubkey, opcode, OP_1])
|
ret = CScript([pubkey, opcode, OP_1])
|
||||||
|
Loading…
Reference in New Issue
Block a user