Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

stack_hex not displaying correctly when stack contains the number 0 #41

Open
ghost opened this issue Nov 18, 2019 · 3 comments
Open

stack_hex not displaying correctly when stack contains the number 0 #41

ghost opened this issue Nov 18, 2019 · 3 comments

Comments

@ghost
Copy link

ghost commented Nov 18, 2019

examples:

script      0 OP_NOT
script_hex  0091
stack       1
stack_hex   01
results     success

script      1 OP_NOT
script_hex  5191
stack       0
stack_hex                                {missing 00}
results     success

script      0 0 OP_SUB
script_hex  000094
stack       0
stack_hex                                {missing 00}
results     success

script      1 0 OP_SUB
script_hex  510094
stack       1
stack_hex   01
results     success

script      127 0 127 1
script_hex  017f00017f51
stack       0x7f 0x 0x7f 1                {0x?}
stack_hex   7f7f01                        {missing 00}
results     success
@jb55
Copy link
Owner

jb55 commented Dec 2, 2019 via email

@ghost
Copy link
Author

ghost commented Dec 3, 2019

Seems to be two issues:

  1. sn_serialize does not serialize the number zero. Easy fix.
  2. OP_0 is represented on the stack as an empty item, (not the number 0). According to the documentation that is OK. Empty stack items are shown as 0x in stack output which seems like an accident; not shown in stack_hex at all. Perhaps an empty array could be displayed as [] in both cases?

Documentation: https://en.bitcoin.it/wiki/Script
OP_0, OP_FALSE An empty array of bytes is pushed onto the stack. (This is not a no-op: an item is added to the stack.)

@jb55
Copy link
Owner

jb55 commented Dec 3, 2019 via email

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 a pull request may close this issue.

1 participant