Skip to content

Conversation

just-erray
Copy link

This PR fixes a bug that causes an unexpected behaviour while pushing Vec<u8> or bitcoin::Witness to the stack. If a single length Vec<u8> was pushed to the stack [x], satisfying 128 <= x < 256, it was being interpreted as pushing [x, 0], causing both numbers pushed through Witness and single length vectors to act unexpectedly.

Copy link
Contributor

@sander2 sander2 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Just one note: this does make pushing [x] where 1 <= x <= 16 less efficient - one byte can be saved by doing the optimization that push_int was doing

@just-erray
Copy link
Author

While applying @sander2's suggestion, I also realized that pushing [x] satisfying 128 < x < 256 with push_slice resulted in an invalid instruction, so I've split the single element case into 3 parts. This should now both be optimized and functioning properly.

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.

2 participants