-
Notifications
You must be signed in to change notification settings - Fork 831
Check for SIGHASH_SINGLE bug in writer fn #897
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
Check for SIGHASH_SINGLE bug in writer fn #897
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are we sure that the right way here is to error and not panic?
On further reflection I think we should just document that this function does the wrong thing with the SIGHASH_SINGLE bug, and that if the user intends to care about this, they should either call Changing an infallible function to a fallible one, without changing the type signature, seems like a bad change to make to the library. |
I might've asked this already on IRC and I don't remember the answer. |
I think the original author #485 just made it public and nobody noticed or complained. I don't remember explicitly thinking about this ever. |
Ah, great, thanks for finding this. So -- if we added an error case, and the author has So I think we should just document "does the wrong thing given the sighash single bug". Maybe we should even make this explicit, by feeding |
27a5818
to
63d689c
Compare
Total re-write of PR including update of PR description. I built the docs and they look ok to me but please not the |
Recently we moved the logic for checking for the SIGHASH_SINGLE bug to the `signature_hash()` function. Although this left users of the `encode_signing_data_to()` function without correct handling of the bug there is not much else we can do but alert users to this behaviour. Add documentation to highlight the behaviour of `encdoe_signing_data_to` in regards to the sighash single bug. Requires updating docs for `signature_hash` also. Please note, uses non-conventional markdown header `# Warning`.
63d689c
to
83dda74
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ACK 83dda74. This is much cleaner
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ACK 83dda74
Not merging: waiting for @apoelstra approval as well, since he was the main person addressing this issue in the previous PR version and elsewhere
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ACK 83dda74
Thank you for waiting for me!
Recently we moved the logic for checking for the SIGHASH_SINGLE bug to
the
signature_hash()
function. Although this left users of theencode_signing_data_to()
function without correct handling of the bugthere is not much else we can do but alert users to this behaviour.
Add documentation to highlight the behaviour of
encdoe_signing_data_to
in regards to the sighash single bug. Requires updating docs for
signature_hash
also.Please note, uses non-conventional markdown header
# Warning
.Closes: #817