Skip to content

Fix ASM ambiguity

Closes: #27795 Closes: #7996

Previously ScriptToAsmStr returned hex-encoded values, except if data length was <= 4 bytes, in which case it displayed using decimal encoding.

Fix the ASM representation by specifying an unambiguous encoding:

  • Drop OP_ prefix from all opcodes
  • For non-minimal pushes prefix with the opcode and enclose pushed hex value in angle brackets PUSHDATA1<0100>
  • For minimal pushes:
    • If > 5 bytes display pushed hex value enclosed in angle brackets <...>
    • If <= 5 bytes:
      • If minimally-encoded display pushed value in decimal without angle brackets 42
      • If not minimally-encoded display pushed hex value enclosed in angle brackets <4200>
    • Display undecodable bytes using UNDECODABLE(...)

This should permit unambiguous decoding in the future.

Merge request reports

Loading