You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
As of 956c8b6 we detect the broadcast of a pj proposal with non-segwit inputs by looping through all the inputs of the proposal and checking if they were all spent. This is flawed.
if outpoints_spend == payjoin_proposal.unsigned_tx.input.len(){// All the payjoin proposal outpoints were spent. This means our payjoin proposal has non-segwit inputs and is broadcasted.returnMaybeFatalOrSuccessTransition::success(SessionEvent::Closed(// TODO: there seems to be not great way to get the tx of the tx that spent these outpoints.SessionOutcome::Success(vec![]),));}
If some of them were spent but not all we consider this a double spend.
else if outpoints_spend > 0{// Some outpoints were spent but not in the payjoin proposal. This is a double spend.returnMaybeFatalOrSuccessTransition::success(SessionEvent::Closed(SessionOutcome::Failure,));}
And if none of them were spent then the receiver is still monitoring for activity.
However all of the proposal outpoints could just be spent in seperate txs unrelated to the payjoin. The API would still consider this a successful Payjoin.
I don't have a great proposed solution for detecting a payjoin with non-segwit inputs at the time of writing this. If the proposal includes non-segwit inputs the reciever could just skip the monitoring typestate all together.
Expanding on the issue, the current implementation results in the following: whenever the sender spends the original proposal UTXO in another transaction, Receiver is going to treat it as a double-spend attack. So if the sender does RBF (as talked about in the integration test PR), or simply decides to use the UTXO in another payment while the v2 Payjoin is still on-going, then the Receiver treats that action as a double-spend attempt.
Activity
mehmetefeumit commentedon Dec 5, 2025
Expanding on the issue, the current implementation results in the following: whenever the sender spends the original proposal UTXO in another transaction, Receiver is going to treat it as a double-spend attack. So if the sender does RBF (as talked about in the integration test PR), or simply decides to use the UTXO in another payment while the v2 Payjoin is still on-going, then the Receiver treats that action as a double-spend attempt.