-
Notifications
You must be signed in to change notification settings - Fork 37.7k
rpc: Only allow specific types to be P2(W)SH wrapped in decodescript #23486
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
Conversation
8888154
to
fa95a43
Compare
Concept ACK. For slightly easier review, maybe split into a pure refactor/reformat commit and the actual behavior change. |
If you pass in |
The following sections might be updated with supplementary metadata relevant to reviewers and maintainers. ConflictsReviewers, this pull request conflicts with the following ones:
If you consider this pull request important, please also help to review the conflicting pull requests. Ideally, start with the one that should be merged first. |
I agree with @Sjors here. I think it makes sense to split the functionality change into a separate commit. Even if it can still be reviewed by providing extra arguments to diff, it just seems cleaner, say, when browsing git history later. Does this need a functional test? |
fa95a43
to
fa1c1f4
Compare
There are steps to test in the first comment, but I am happy to add a commit with tests if someone writes them. I am also happy to review a pull if someone adds them after merge. |
tACK fa1c1f4 |
fa1c1f4
to
faa8ea8
Compare
faa8ea8
to
b9cc200
Compare
fa827d2
to
fa972d8
Compare
Reworked and updated pull request description |
We may also need to check that no OP_CHECKSIGADD opcodes occur in a script before reporting a P2WSH for it. |
And OP_SUCCESSx too |
fa972d8
to
fa20010
Compare
And unparseable, and unspendable scripts. |
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.
Even without the two issues mentioned below, it seems that decodescript
is unable to decode scripts containing OP_CHECKSIGADD
and OP_SUCCESSx
. But I think fixing those would be out of scope for this PR.
2e26400
to
faa1b5e
Compare
Force pushed to fix a "typo" 😖 and updated OP to include more tests. |
faa1b5e
to
fa0aec3
Compare
src/rpc/rawtransaction.cpp
Outdated
break; | ||
case TxoutType::NULL_DATA: | ||
case TxoutType::SCRIPTHASH: | ||
case TxoutType::WITNESS_UNKNOWN: |
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.
Isn't it TBD if future witnesses can be wrapped? Though maybe too unlikely to matter...
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.
It is possible but unlikely. In that case you need to upgrade to a version of Bitcoin Core that "understands" the witness program to wrap it.
fa0aec3
to
fabf3d0
Compare
fadc110
to
fad77aa
Compare
fad77aa
to
9999342
Compare
Rebased to add tests ✨ |
Code review re-ACK 9999342 |
@@ -38,38 +36,21 @@ | |||
"6a00", | |||
{ | |||
"asm": "OP_RETURN 0", | |||
"type": "nulldata", | |||
"p2sh": "2NG8CqGyR16jkZU5H7J9WM5xpCT6Fpw6bww" | |||
"type": "nulldata" | |||
} | |||
], | |||
[ | |||
"6aee", | |||
{ | |||
"asm": "OP_RETURN OP_UNKNOWN", |
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.
(not in this PR) it would be nice to have some test entries that do give segwit
output
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.
good first issue ;)
…W)SH wrapped in decodescript 086d811 rpc: Only allow specific types to be P2(W)SH wrapped in decodescript (MarcoFalke) Pull request description: It seems confusing to return a P2SH wrapping address that is eventually either policy- or consensus-unspendable. ACKs for top commit: laanwj: Code review re-ACK 086d811 Tree-SHA512: 3cd530442acee7c295d244995f0f17b2cae7212f1e0970bb5807621f8ff8e4308a3236b385d77087cd493d32ee524813d8edd15e91d937ef9a800094b7bc4946
It seems confusing to return a P2SH wrapping address that is eventually either policy- or consensus-unspendable.