smite: add is_standard_shutdown_script helper - #186
Conversation
f33051b to
22217d9
Compare
NishantBansal2003
left a comment
There was a problem hiding this comment.
Thanks! I was about to add this as a follow-up to #185, but it looks like I don’t have to now
22217d9 to
220b1bf
Compare
220b1bf to
847c2f1
Compare
NishantBansal2003
left a comment
There was a problem hiding this comment.
Mostly, it looks good. Just a few small comments. I'm not sure how this follows the merge with #192, but if it's merged before, I'll add the updated feature check there
dd42b6b to
63fed11
Compare
|
I rebased this PR on top of #192 since I don't expect it to change much. I didn't address all feedback yet, see #186 (comment) and TODO in the code + commit message. |
63fed11 to
6b8d367
Compare
|
TODO:
|
6b8d367 to
c62c850
Compare
|
c62c850: rebased on master (87ebab6), added f024116: fixed wrong usage of backticks in |
c62c850 to
f024116
Compare
BOLT-02 specifies sender requirements for shutdown scripts. They must be witness v0 (P2WPKH, P2WSH) or following features must be negotiated: * `option_shutdown_anysegwit`: witness v1-v16 with a 2..=40 byte program * `option_simple_close`: `OP_RETURN` with a single minimal data push of 6..=80 bytes This applies to the `shutdown` and `closing_complete` messages, and the `upfront_shutdown_script` TLV in the `open_channel`, `open_channel2`, `accept_channel` and `accept_channel2` messages. This commit adds two helpers to catch targets that don't comply with the spec: is_standard_shutdown_script and is_acceptable_shutdown_script.
f024116 to
ab9cbad
Compare
Depends on #192.
From the commit message:
As per the note I added to the code, I'm not sure if the fuzzer should also reject legacy scripts, since a target must not send them.update: decided to reject them, see discussionI haven't wired this into existing code or #163 yet, but I thought the introduction of the helper might be worthwile to review itself, especially considering the question wrt legacy scripts.