mirror of
https://github.com/kaspanet/kaspad.git
synced 2026-03-06 09:01:34 +00:00
txscript: Match Bitcoin Core OP_IFDUP behavior.
Unlike OP_IF and OP_NOTIF which interpret the top stack item as a number, OP_IFDUP interprets it as a boolean. This has important consequences because numbers are imited to int32s while booleans can be an arbitrary number of bytes. The offending script was found and reported by Jonas Nick through the use of fuzzing.
This commit is contained in:
@@ -80,6 +80,7 @@
|
||||
|
||||
["0 IFDUP", "DEPTH 1 EQUALVERIFY 0 EQUAL", "P2SH,STRICTENC"],
|
||||
["1 IFDUP", "DEPTH 2 EQUALVERIFY 1 EQUALVERIFY 1 EQUAL", "P2SH,STRICTENC"],
|
||||
["0x05 0x0100000000 IFDUP", "DEPTH 2 EQUALVERIFY 0x05 0x0100000000 EQUAL", "P2SH,STRICTENC", "IFDUP dups non ints"],
|
||||
["0 DROP", "DEPTH 0 EQUAL", "P2SH,STRICTENC"],
|
||||
["0", "DUP 1 ADD 1 EQUALVERIFY 0 EQUAL", "P2SH,STRICTENC"],
|
||||
["0 1", "NIP", "P2SH,STRICTENC"],
|
||||
|
||||
Reference in New Issue
Block a user