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
payjoin-cli should demonstrate tx cut-through and utxo consolidation usage #1859
payjoin-cli is meant to be a reference implementation. We've built the API largely around enabling the receiver to do tx cut through and utxo consolidation, among others. There are a few integration tests that demonstrate this, but it would be cool to have these modes implemented in the reference cli as well. Perhaps receive can operate with different modes, e.g. --cut-through <address>, --consolidate...
Hey @spacebear21 i'd love to take a jab at this as my first contribution to payjoin-cli and second contribution to rust-payjoin
So here's what I'm thinking and i'd really appreciate any pointers i can get.
i understand that the two modes in the issue are independent of each other. Consolidation is about the inputs the receiver adds, cut-through is about the outputs. That means you could reasonably want both at once i.e forward part of a payment to a supplier and tidy up your UTXO set in the same transaction.
The integration tests you mentioned per feature:
--consolidate — contribute all available UTXOs instead of a single
privacy-preserving one. Same thing receiver_consolidates_utxos does
in the integration tests.
I'm planning one PR with two commits, so each one is self-contained and easier to review:
--consolidate — adds the flag, wires it up in the v1 and v2 receiver paths, e2e test, README.
--cut-through — same shape as above.
I'd originally planned a third commit to make the flags survive payjoin-cli resume, but I think it belongs in both from the start rather than as a follow-up fix. Config is built once from the commandline at startup, and the flags are only read when the subcommand is Receive so on a resume run they're absent and silently fall back to the default.
My instinct is to store the setting per-session in the CLI's own receive_sessions table, since it's an application preference
Both the fresh and the resumed run would then read the same row, so there's a single source of truth and no second code path to drift. I'd lean toward one serialized receive_options column rather than a column per setting. it matches how receive_session_events already stores event_data, and adding an option later becomes a struct field instead of another schema change.
Hey @AdamuAbba , thanks for volunteering! That all sounds reasonable, I think it's worth attempting as you described then iterating from there once we have a PR.
Activity
AdamuAbba commentedon Sep 10, 2026
Hey @spacebear21 i'd love to take a jab at this as my first contribution to payjoin-cli and second contribution to rust-payjoin
So here's what I'm thinking and i'd really appreciate any pointers i can get.
i understand that the two modes in the issue are independent of each other. Consolidation is about the inputs the receiver adds, cut-through is about the outputs. That means you could reasonably want both at once i.e forward part of a payment to a supplier and tidy up your UTXO set in the same transaction.
The integration tests you mentioned per feature:
--consolidate— contribute all available UTXOs instead of a singleprivacy-preserving one. Same thing
receiver_consolidates_utxosdoesin the integration tests.
rust-payjoin/payjoin/tests/integration.rs
Line 1286 in e4eddca
--cut-through <address>:<amount>— send part of the incoming paymenton to a third party, as seen here
receiver_forwards_payment.rust-payjoin/payjoin/tests/integration.rs
Line 1375 in e4eddca
I'm planning one PR with two commits, so each one is self-contained and easier to review:
--consolidate— adds the flag, wires it up in the v1 and v2 receiver paths, e2e test, README.--cut-through— same shape as above.I'd originally planned a third commit to make the flags survive
payjoin-cli resume, but I think it belongs in both from the start rather than as a follow-up fix.Configis built once from the commandline at startup, and the flags are only read when the subcommand isReceiveso on aresumerun they're absent and silently fall back to the default.My instinct is to store the setting per-session in the CLI's own
receive_sessionstable, since it's an application preferencerust-payjoin/payjoin-cli/src/db/mod.rs
Lines 51 to 57 in e4eddca
Both the fresh and the resumed run would then read the same row, so there's a single source of truth and no second code path to drift. I'd lean toward one serialized
receive_optionscolumn rather than a column per setting. it matches howreceive_session_eventsalready storesevent_data, and adding an option later becomes a struct field instead of another schema change.so let me know what you guys think?
spacebear21 commentedon Sep 10, 2026
Hey @AdamuAbba , thanks for volunteering! That all sounds reasonable, I think it's worth attempting as you described then iterating from there once we have a PR.