Repository navigation
v9.11.2 — an empty push is no longer lost when a script is written as text
An empty push is no longer lost when a script is written as ASM or as a string. This is a patch: no API change.
Both text forms wrote nothing for an empty data push:
| script | 9.11.1 | 9.11.2 |
|---|---|---|
514c0051, an empty OP_PUSHDATA1 push |
ASM OP_1 OP_1, which reads back as 5151 with the push lost; string OP_1 OP_PUSHDATA1 OP_1, which could not be read |
ASM OP_1 0 OP_1; string OP_1 OP_PUSHDATA1 0 0x OP_1, which reads back exactly |
Script.buildDataOut(''), which is 6a00 |
OP_RETURN in both forms, which reads back as 6a |
ASM OP_RETURN 0; string OP_RETURN OP_0 |
ASM writes an empty push minimally, as 0. toString writes OP_PUSHDATA1 0 0x, which fromString already read, or OP_0, as it already did for 6a00 parsed from bytes. No reader changes: every text 9.11.1 wrote is read the same way. Of 4,000 generated scripts, the 909 whose text changes all contain an empty push, and all read back exactly.
Reported by the scriptmin work (codenlighten/scriptmin#4). The same fix is in smartledger-bsv-core (codenlighten/smartledger-bsv-core#12).
Full notes: CHANGELOG.md