Repository navigation
Input weight prediction helpers for nested P2WPKH - #3443
Merged
apoelstra merged 2 commits intoOct 9, 2024
Merged
Conversation
Add helpers for input weight predictions corresponding to P2WPKH nested in a P2SH output (nested segwit).
Clarify that the returned weight doesn't include txid, index, or sequence weights.
Pull Request Test Coverage Report for Build 11171505097Details
💛 - Coveralls |
yancyribbens
reviewed
Oct 5, 2024
| /// Tallies the total weight added to a transaction by an input with this weight prediction, | ||
| /// not counting potential witness flag bytes or the witness count varint. | ||
| /// Computes the **signature weight** added to a transaction by an input with this weight prediction, | ||
| /// not counting the prevout (txid, index), sequence, potential witness flag bytes or the witness count varint. |
Contributor
There was a problem hiding this comment.
It seems like signature_weight() would be a better name for this method eventually.
Contributor
Author
There was a problem hiding this comment.
Agreed, I suggested deprecating in the top comment but if it'll stay exposed it would be good to change the name to avoid confusion.
Member
There was a problem hiding this comment.
I would prefer witness_weight or something. Unsure. signature_weight may suggest to some users that it's specifically about EC signatures.
In any case, this PR looks good as-is.
tcharding
approved these changes
Oct 9, 2024
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Following up on #630 (comment).
I amended the docstring on
InputWeightPrediction::weight()to clarify that it only returns the signature weight. I'm not sure what the rationale was for only returning partial input weight, and if there are any arguments against something likeInputWeightPrediction::total_weight()which returnsself.weight() + Weight::from_non_witness_data_size(32 + 4 + 4)(and maybe deprecateweight()eventually to prevent misuse).