Skip to content

Fix byte-concat handling for single 0x00 byte payloads#49

Open
michaelsutton wants to merge 2 commits intokaspanet:masterfrom
michaelsutton:byte-concat-zero-byte-test
Open

Fix byte-concat handling for single 0x00 byte payloads#49
michaelsutton wants to merge 2 commits intokaspanet:masterfrom
michaelsutton:byte-concat-zero-byte-test

Conversation

@michaelsutton
Copy link
Contributor

Fixes a compiler emission bug where pushing a single zero byte ([0x00]) was canonicalized to OP_0 (empty bytes), which broke byte concatenation cases like byte[] + byte + byte[] when the middle byte was zero.
It introduces a ScriptBuilder extension method (add_data_preserving_single_zero) that emits exact one-byte zero payloads via 0 1 OP_NUM2BIN, and uses it across compiler byte/data push paths.
Added regression tests cover zero-byte concat and the byte / byte[1] / byte[] single-zero forms.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant