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
{{ message }}
Repository navigation
Printing a PjUri drops non-payjoin recognized params #2050
check_pj_supported builds a new URI from the fields payjoin knows (address, amount, label, message, pj, pjos) instead of keeping the one it parsed, so a PjUri prints without everything else. Parse bitcoin:bc1q…?amount=0.01&lightning=lnbc…&pj=https://…, call check_pj_supported, and to_string() comes back without lightning=. Same for sp= or any unknown key. This is the payjoin crate half of payjoin/bitcoin_uri#10. bitcoin_uri 0.2 prints a parsed URI exactly as it came in, and a plain payjoin Uri does too since #1975, but a PjUri still doesn't.
check_pj_supported should keep the parsed bitcoin_uri::Uri. The catch is set_amount. A bitcoin_uri 0.2 Uri can't be edited, so setting an amount means rebuilding, and the builder is stricter than the parser, so some parsed URIs can't be rebuilt as written.
set_amount is a receiver urtility. It's public for v1 receivers, who call it after build_v1_pj_uri, as payjoin-cli does. v2 receivers already pass the amount up front with ReceiverBuilder::with_amount. The amount belongs on the receiver side, set before the URI exists, and a receiver should be able to set a label and message there too. Right now it can't set those at all.
The plan:
check_pj_supported keeps the parsed URI, so a sender's PjUri prints what it parsed.
Either receivers get a builder for amount, label and message, for v1 and v2, built on bitcoin_uri::UriBuilder, or they use bitcoin_uri::UriBuilder directly and payjoin hands out its pj and pjos params together as strings (I'm leaning toward the latter). To be discussed. Deprecate PjUri::set_amount and payjoin-ffi's set_amount_sats in favor of whichever we pick, and document that set_amount on a parsed URI drops non-payjoin params.
Activity
MayurK-cmd commentedon Nov 12, 2026
hey can i work on this one?
caarloshenriq commentedon Nov 13, 2026
I put step 1 in #1975 as a new commit since it changes code that PR adds