-
Notifications
You must be signed in to change notification settings - Fork 32
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
Validate sender input to complete e2e payjoin test with receiver contribution #22
Conversation
5882671
to
a4437a3
Compare
payjoin/src/sender/mod.rs
Outdated
); | ||
if let Some(script_sig) = &proposed.psbtin.final_script_sig { | ||
total_weight += Weight::from_non_witness_data_size( | ||
32 + 4 + 4 + script_sig.encoded_size(), |
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.
if there's no script_sig you don't add the 32 + 4 + 4
to the total weight, I assume that is the outpoint and sequence values
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.
Thanks for the review Ben 🎈
Your assumption is correct, and is now documented.
Isn't this the branch where there is indeed a script_sig? The no script_sig should be handled by if let Some(script_witness)
below. Do you mean if the transaction has no segwit inputs?
Do you have a clue what unit tests for this code might be useful? I guess I should find some transactions with known weights and check this code against them. There are some examples in that referenced issue but I don't know where they came from.
39df3b6
to
5911ef1
Compare
Verify receiver PSBT inputs are finalized and contribute weight. final_script_sig, final_script_witness may be independent or present together as in the case of a P2WSH spend. This only adds input-specific weight. The check_fees method calculates cumulative weight changes.
5911ef1
to
575b7d4
Compare
575b7d4
to
6073866
Compare
Finally! Not just input substitution! Full on payjoin!
The sender change includes Sender input verification
AND weight calculation for the amount of weight those inputs add. Please review for both design and correctness.