[BIP78] Fix client implementation when there is output substitution #1171

pull NicolasDorier wants to merge 1 commits into bitcoin:master from NicolasDorier:woieuq changing 1 files +9 −3
  1. NicolasDorier commented at 6:47 AM on August 31, 2021: contributor

    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.
  2. [BIP78] Fix client implementation when there is output substitution d8db3d7608
  3. NicolasDorier force-pushed on Aug 31, 2021
  4. kallewoof merged this on Aug 31, 2021
  5. kallewoof closed this on Aug 31, 2021

  6. NicolasDorier deleted the branch on Aug 31, 2021
  7. junderw referenced this in commit 75fc02b0ad on Aug 31, 2021
  8. junderw cross-referenced this on Aug 31, 2021 from issue Fix bug from BIP78 reference implementation by junderw
  9. junderw cross-referenced this on Sep 1, 2021 from issue Bugfix: Bump payjoin-client from 1.0.0 to 1.0.1 by junderw
Contributors

github-metadata-mirror

This is a metadata mirror of the GitHub repository bitcoin/bips. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2026-04-14 15:10 UTC

This site is hosted by @0xB10C
More mirrored repositories can be found on mirror.b10c.me