-
Notifications
You must be signed in to change notification settings - Fork 38.7k
Replace GetScriptForWitness with GetScriptForDestination #16841
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
Replace GetScriptForWitness with GetScriptForDestination #16841
Conversation
|
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. |
| Needs rebase |
src/test/txvalidationcache_tests.cpp
Outdated
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.
I'd suggest not mixing up the semantically identical PKHash(pubkey) (line 161) and pubkey.GetID() (line 162) here for getting from a public key to a public key hash, see also comment below.
|
Looks good to me. Just one pedantic addition: To get from public key to public key hash, two variants are in use:
I'm quite new to the Bitcoin code base, but personally I would find the |
Okay, thanks for the explanation, this brought some clarity. So whenever a public key hash is only used for further processing but is not yet a destination, |
achow101
left a comment
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.
Concept ACK
src/rpc/rawtransaction_util.cpp
Outdated
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.
This was already done in #18484. I think there's a hidden merge conflict here.
src/test/transaction_tests.cpp
Outdated
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.
nit: It might be easier to read if you made a variable for these scripts instead of copying the same script generation line around.
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.
this is resolved in the third commit(not to reviewers)
|
🐙 This pull request conflicts with the target branch and needs rebase. |
|
Rebased and review comments addressed |
|
ACK ed266f7ca52fd0df2dd2e25bb9fdf9e5c6888eb9 |
|
@sipa thanks for the review, but all your comments were already addressed in the third commit :) |
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 ed266f7ca52fd0df2dd2e25bb9fdf9e5c6888eb9
Edit: modulo #16841 (comment)
|
Sanity check: with only the changes in |
|
🐙 This pull request conflicts with the target branch and needs rebase. Want to unsubscribe from rebase notifications on this pull request? Just convert this pull request to a "draft". |
|
re-ACK 7966aa4 only changes since last is rebase. |
|
ACK 7966aa4 nice to see it gone, much easier to read |
jonatack
left a comment
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.
Code review re-ACK 7966aa4 per git range-diff b4d0366 ed266f7 7966aa4
|
Perhaps note #16841 (comment) / keep in mind. |
|
utACK |
…tination 7966aa4 Add variables for repeated scripts (MeshCollider) fec8336 Remove GetScriptForWitness function (MeshCollider) b887060 Replace usage of GetScriptForWitness with GetScriptForDestination (MeshCollider) Pull request description: As per this TODO in the code: > TODO: replace calls to GetScriptForWitness with GetScriptForDestination using the various witness-specific CTxDestination subtypes. The commit "Add additional check for P2SH before adding extra wrapper" also adds an additional check that the scriptPubKey is a P2SH before auto-wrapping the witness script. We shouldn't wrap the witness script if not. Note: bitcoin#16251 is even better than this check, please review that. ACKs for top commit: instagibbs: ACK bitcoin@7966aa4 jonatack: Code review re-ACK 7966aa4 per `git range-diff b4d0366 ed266f7 7966aa4` achow101: re-ACK 7966aa4 only changes since last is rebase. Tree-SHA512: 3449e0e83bd842acc7c94544a85367da97ac20d859eefc1a618caef0c98204398c266fe8fb9600b78326df5175402e1ae4a132eb766e2c4485e7cda6a2a95c43
As per this TODO in the code:
The commit "Add additional check for P2SH before adding extra wrapper" also adds an additional check that the scriptPubKey is a P2SH before auto-wrapping the witness script. We shouldn't wrap the witness script if not. Note: #16251 is even better than this check, please review that.