Fix send success log error and order#1498
Conversation
Print "Posted original proposal..." only after process_response succeeds so users don't see a false success banner when the directory rejects or truncates the OHTTP response. Also propagate errors from process_sender_session through tokio::select! instead of silently returning Ok(()).
Coverage Report for CI Build 24774218494Coverage remained the same at 84.92%Details
Uncovered ChangesNo uncovered changes found. Coverage RegressionsNo coverage regressions found. Coverage Stats
💛 - Coveralls |
|
Not on my PC for now so i can't really test things out. However this seem to hinge on what our definition of "posting the original proposal " means.
since process_response will only return success when the original proposal has been accepted , i'll say the log message was aimed at point 1 above which imho is still correct. |
|
Before this fix, while playing around the payjoin-cli, i encountered the issue raised in the PR which was "Posted original proposal..." always printed even when the send failed and exited quietly. The user would see a success message followed by a silent exit with no error. That's exactly the problem that i faced Moving the print after process_response ensures it only appears when the proposal actually reaches the directory. The tokio::select! fix ensures that when something does go wrong, the error message is shown to the user instead of being silently discarded. So i think based on the Expected behavior i would also like to get your feedback too |
If it hasn't hit the directory then it hasn't been posted, and the message is misleading. |
spacebear21
left a comment
There was a problem hiding this comment.
tACK 8cc3bc2
on failure pointing to the same ohttp relay as the directory:
❯ cargo run -- send $BIP21 --fee-rate 1
Finished `dev` profile [unoptimized + debuginfo] target(s) in 0.12s
Running `/Users/spacebear/Projects/rust-payjoin/target/debug/payjoin-cli send 'bitcoin:bcrt1qjf69494jh08hgu32srynxfpznatmn35pycxfh0?amount=0.00001&pjos=0&pj=HTTPS://PAYJO.IN/FWGEGWG8H27CY%23EX1MFQW56G-OH1QYPFLM8XL59R0XV4VGPLS7FRDSSM4TUXL07TXCWC4S0GLVLNK2SE4NQ-RK1QDSC8SJ8ZVNNPPVZ4LUVY0WYDJ9STVUALM7RNLC9C0TK6LKGZN6MW' --fee-rate 1`
Bootstrapping private network transport over Oblivious HTTP
Error: Transient error: Directory response error: Unexpected response size 0, expected 8192 bytes
and on success with a different ohttp relay:
❯ cargo run -- send $BIP21 --fee-rate 1
Finished `dev` profile [unoptimized + debuginfo] target(s) in 0.15s
Running `/Users/spacebear/Projects/rust-payjoin/target/debug/payjoin-cli send 'bitcoin:bcrt1qjf69494jh08hgu32srynxfpznatmn35pycxfh0?amount=0.00001&pjos=0&pj=HTTPS://PAYJO.IN/FWGEGWG8H27CY%23EX1MFQW56G-OH1QYPFLM8XL59R0XV4VGPLS7FRDSSM4TUXL07TXCWC4S0GLVLNK2SE4NQ-RK1QDSC8SJ8ZVNNPPVZ4LUVY0WYDJ9STVUALM7RNLC9C0TK6LKGZN6MW' --fee-rate 1`
Bootstrapping private network transport over Oblivious HTTP
Posted original proposal...
Proposal received. Processing...
Payjoin sent. TXID: b4c7c49ebb9790f38dec059dd3e29e858f74f9735c9835fe0288149aacaf8717
|
Thank you @spacebear21 |
This PR addresses the issue in #1394 where payjoin-cli "send" command silently exits when process_response fails. Two bugs were identified and fixed:
println!("Posted original proposal...") fired before process_response validated the directory response, showing a false success banner even on failure.
tokio::select! in send_payjoin discarded the Result from process_sender_session with _ = ... => return Ok(()), silently swallowing all errors.
The fix moves the print statement after validation and propagates the result with res = ... => return res, so errors reach main.rs where anyhow prints them.
Manually tested with self-loop configuration (relay = directory) confirming the error Unexpected response size 0, expected 8192 bytes is now surfaced and the process exits non-zero.
I brainstormed the implementation approach with Claude while working through this fix.
Please confirm the following before requesting review:
AI
in the body of this PR.