python-bitcoinlib
python-bitcoinlib copied to clipboard
Treat OP_1NEGATE as a small integer
Similar to Bitcoin Core's https://github.com/bitcoin/bitcoin/pull/29589
This is technically a breaking change, so would require a major version bump.
I voiced my concerns about changing the behavior of encode_op_n/decode_op_n in the Core's issue linked in the first message, but here I want to mention that if you proceed with this change of behavior, you will also need to fix is_witness_scriptpubkey() that uses is_small_int() to check that the witness version is in bounds. OP_1NEGATE is not allowed as witness version.