LedgerHQ / app-bitcoin-new

Modern Bitcoin Application based on PSBT and Descriptors
Apache License 2.0
95 stars 71 forks source link

Fix "minimal push" check for OP_RETURN outputs #265

Closed bigspider closed 3 months ago

bigspider commented 4 months ago

An output like

6a 5d 0100 ==> OP_RETURN 13 0

is incorrectly rejected. While

6a 5d 0101 ==> OP_RETURN 13 1

is correctly rejected (because OP_1 is a shorter push opcode to push 0x01 on the stack), that's not true for OP_0 which pushes the empty array on the stack, and it's not the same as the 0x00 byte array.