-
Notifications
You must be signed in to change notification settings - Fork 76
Skip check_payment in Receiver<Monitor> if the sender is using non-segwit address #1218
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
Skip check_payment in Receiver<Monitor> if the sender is using non-segwit address #1218
Conversation
7117416 to
4c1789e
Compare
Pull Request Test Coverage Report for Build 20173359100Details
💛 - Coveralls |
arminsabouri
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.
ConceptAck. This fixes the immediate bug in our monitoring type state.
I am assuming #1211 shold probably preceed this PR?
Yeah. Going to add new test scenarios for non-SegWit to this PR once the integration test changes are merged. |
4fa6fb1 to
fb26ec9
Compare
fb26ec9 to
d3b5192
Compare
arminsabouri
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.
cACK.
Just one comment about copy displayed in the history subcommand
…gwit address The previous implementation of the check_payment function assumed that if the outpoints of the Payjoin transaction have been removed from the UTXO set, it is an indication of the Payjoin being broadcasted by the sender. Moreover, it relied on the same closure to detect whether there is a double-spend attempt from the sender, if only a subset of the outpoints have been spent. Both of the usages of the outpoint closure is incorrect. If the sender does RBF on the fallback transaction, this would change the transaction ID and cause the previous implementation to incorrectly detect double-spend. Moreover, the sender can use some of the UTXOs in the Payjoin session if they wish without necessarily "attacking" the receiver. This change removes the outpoint closure, and instead skips the check if the fallback transaction has any inputs which does not have witness data. This assumes that the fallback transaction has been signed which is a certainty at this point in the Payjoin session.
d3b5192 to
fb368c0
Compare
arminsabouri
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.
utACK fb368c0
|
Has there been any discussion about not allowing this state ReceiverSessionOutcome::PayjoinProposalSent => And instead requiring that clients that support non-SegWit inputs instead rely on an address index like esplora, allowing the state machine and clients to be simplified. I understand that this would limit our reference implementation, but the index is a sort of prerequisite for any full on wallet that we've integrated with in the past. |
|
We did briefly talk about how since not all clients have an address index, we could not reliably change this into something which would provide consistent experience. If I got it right, your suggestion is to only remove the new state, and change the documentation, etc. around the state to reference an address index usage to solve the non-SegWit problem. That makes sense to me. Trying to wrap my head around how it looks like in two different cases:
For the second point, let me know if you have any information! Otherwise I understand that real world usages will have address index capabilities to make this possible. Let me create an issue for it to move the discussion there. |
I think we can simplify by disallowing non-SegWit inputs in the reference implmentation.
I think the closure would change to be |
Pull Request Checklist
Please confirm the following before requesting review:
AI
in the body of this PR.
Overview
The previous implementation of the check_payment function assumed that if the outpoints of the Payjoin transaction have been removed from the UTXO set, it is an indication of the Payjoin being broadcasted by the sender. Moreover, it relied on the same closure to detect whether there is a double-spend attempt from the sender, if only a subset of the outpoints have been spent.
Both of the usages of the outpoint closure is incorrect. If the sender does RBF on the fallback transaction, this would change the transaction ID and cause the previous implementation to incorrectly detect double-spend. Moreover, the sender can use some of the UTXOs in the Payjoin session if they wish without necessarily "attacking" the receiver.
This change removes the outpoint closure, and instead skips the check if
the fallback transaction has any inputs which does not have witness
data. This assumes that the fallback transaction has been signed which
is a certainty at this point in the Payjoin session.
Closes #1214.
On the side: this PR also contains another small commit for completing a TODO in the unit tests.
List of Changes
check_paymentfunction and add skip if the fallback transaction is non-segwit.Testing
Next Step
#1211 contains a documentation update for the
check_paymentfunction. Will need to update that if and when this PR gets approved and merged, and also make sure that there are integration tests for covering p2pkh as well.