Skip to content

fix(payjoin): print progress messages to stderr - #398

Open
chukwudiikeh wants to merge 2 commits into
bitcoindevkit:masterfrom
chukwudiikeh:fix/payjoin-progress-stderr
Open

chukwudiikeh wants to merge 2 commits into
bitcoindevkit:masterfrom
chukwudiikeh:fix/payjoin-progress-stderr

Conversation

@chukwudiikeh

Copy link
Copy Markdown
Contributor

Fixes #397

receive_payjoin, send_payjoin and resume_payjoin return a JSON object, but PayjoinManager also printed its progress messages (the Payjoin URI, polling status, resumed sessions, the fallback transaction) to stdout with println!. Piping these commands into a JSON parser got human-readable text followed by JSON, so parsing failed.

This PR switches those 20 println! calls in src/handlers/payjoin/mod.rs to eprintln!. The messages still show in the terminal, but stdout now carries only the JSON.

Fixed

receive_payjoin, send_payjoin and resume_payjoin now print progress messages to stderr, so their stdout is valid JSON.

receive_payjoin, send_payjoin and resume_payjoin printed progress
messages to stdout alongside their JSON output, so the output could
not be parsed as JSON. Print them to stderr instead, so they still
show in the terminal and stdout carries only the JSON.

Fixes bitcoindevkit#397
@codecov

codecov Bot commented Dec 2, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 0% with 20 lines in your changes missing coverage. Please review.
✅ Project coverage is 59.42%. Comparing base (537fbb9) to head (0fd4539).
⚠️ Report is 1 commits behind head on master.

Files with missing lines Patch % Lines
src/handlers/payjoin/mod.rs 0.00% 20 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##           master     #398   +/-   ##
=======================================
  Coverage   59.42%   59.42%           
=======================================
  Files          24       24           
  Lines        4498     4498           
=======================================
  Hits         2673     2673           
  Misses       1825     1825           
Flag Coverage Δ
rust 59.42% <0.00%> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@chukwudiikeh

Copy link
Copy Markdown
Contributor Author

@vadim-anfv @tvpeter please can you take a look at this.A follow-up from your comment on #396.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Todo

Development

Successfully merging this pull request may close these issues.

payjoin commands print progress text to stdout, so their output isn't valid JSON

1 participant