Skip to content

Clear sender input witness before processing PSBT - #241

Merged
DanGould merged 3 commits into
payjoin:masterfrom
spacebear21:clear-sender-inputs
May 7, 2024
Merged

DanGould merged 3 commits into
payjoin:masterfrom
spacebear21:clear-sender-inputs

Conversation

@spacebear21

Copy link
Copy Markdown
Collaborator

Based on ongoing conversation: #51 (comment)

By the time the receiver is applying its own signatures, it should have
extracted the valid Original PSBT Transaction and may remove the
final_scriptwitness.

@DanGould DanGould left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@grizznaut May you share how you were able to set up and test JoinMarket with this change?

Overall looks like a correct implementation. I ask that we consider in this PR if any other signatures (or other field?) should also be removed before apply_fee or wallet_process_psbt are called. Or, if the signature contents removal should be done after apply_fee.

let sender_input_indexes = self.get_sender_input_indexes();
for i in sender_input_indexes {
log::trace!("Clearing sender script witness for input {}", i);
self.payjoin_psbt.inputs[i].final_script_witness = None;

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should final_script_sig and tap_key_sig also be removed at this step? Might they cause problems if they were not removed before wallet_process_psbt of various implementations?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems reasonable to remove all signatures at this step as they would be invalid anyways. Updated and smoke-tested with another test receive.

Comment thread payjoin/src/receive/mod.rs Resolved
Comment thread payjoin/src/receive/mod.rs Resolved
Comment thread payjoin/src/receive/mod.rs Resolved
@spacebear21

spacebear21 commented May 7, 2024 •

Copy link
Copy Markdown
Collaborator Author

May you share how you were able to set up and test JoinMarket with this change?

I reused the same setup I described briefly in the Setup Notes section here #51 (comment), but pulled and built this branch for the payjoin-cli receiver. I can make a more detailed write-up of how I obtained the certificate, setup the nginx proxy, etc. if that would be helpful!

@spacebear21
spacebear21 marked this pull request as ready for review May 7, 2024 14:54
@DanGould
DanGould merged commit d7b1ed9 into payjoin:master May 7, 2024
@DanGould DanGould mentioned this pull request May 30, 2024
2 tasks done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants