← Back to Bitcoin Improvement Proposals
BIPinformationalpsbtpayments

[BIP78] Fix client implementation when there is output substitution

There was a bug in the payjoin client reference implementation if the receiver used output substitution, causing the payjoin to fallback to normal payment unecessarily. Fixing bug reported by @Kixunil (https://github.com/btcpayserver/btcpayserver/issues/2677) Fixed on the C# client (https://github.com/btcpayserver/BTCPayServer.BIP78/commit/451e1126f7b3f5c6bb9b648aa3ac6bd7485996ee) and tested by Kixunil. The bug was best explained by @Kixunil ------- * The code was iterating over proposed PSB

No reviews
NicolasDorier·Updated Aug 31, 2021·0 reviews·0 attestations·View source
Collections:BIPs — Merged

Specification

There was a bug in the payjoin client reference implementation if the receiver used output substitution, causing the payjoin to fallback to normal payment unecessarily.

Fixing bug reported by @Kixunil (https://github.com/btcpayserver/btcpayserver/issues/2677) Fixed on the C# client (https://github.com/btcpayserver/BTCPayServer.BIP78/commit/451e1126f7b3f5c6bb9b648aa3ac6bd7485996ee) and tested by Kixunil.

The bug was best explained by @Kixunil


  • The code was iterating over proposed PSBT outputs and have original outputs in a queue.
  • It was comparing the proposed output to the output at the front of the queue
  • If there are two outputs: payee, payer_change - in this order, then if payee substituted the output, the comparison is false. Then we did nothing with it and thus leaving the output in the queue, blocking the remaining iterations from seeing following outputs.

Discussion (0 threads)

Loading discussions...