Skip to content

Bitcoin peers - #27

Open
R27-pixel wants to merge 9 commits into
p2poolv2:mainfrom
R27-pixel:bitcoin_peers
Open

Bitcoin peers#27
R27-pixel wants to merge 9 commits into
p2poolv2:mainfrom
R27-pixel:bitcoin_peers

Conversation

@R27-pixel

@R27-pixelR27-pixel commented Jun 16, 2026

Copy link
Copy Markdown
Contributor

Add peer information to the Bitcoin Status section.

Currently, peer information only includes the connected peer count and peer addresses.

image

@R27-pixel
R27-pixel marked this pull request as draft June 16, 2026 03:06
@codecov

codecovBot commented Jun 16, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 93.51970% with 51 lines in your changes missing coverage. Please review.

Files with missing linesPatch %Lines
src/components/bitcoin_status_view.rs86.00%21 Missing ⚠️
src/components/bitcoin_client.rs96.03%20 Missing ⚠️
src/app.rs91.96%9 Missing ⚠️
src/main.rs0.00%1 Missing ⚠️

📢 Thoughts on this report? Let us know!

@R27-pixel
R27-pixel marked this pull request as ready for review July 16, 2026 13:58

CopilotAI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds Bitcoin Core RPC-backed chain/peer details to the Bitcoin Status UI, replacing placeholder panels with real content and wiring background polling into the app loop.

Changes:

  • Introduces a new BitcoinClient to query Bitcoin Core RPC for chain info, connection count, and peer addresses.
  • Wires Bitcoin chain info fetching/polling into App and the main render loop, and renders Chain Info + Peers tabs with loading/error/empty states.
  • Improves P2Pool share rendering by deduplicating live shares (and adds a regression test).

Reviewed changes

Copilot reviewed 8 out of 8 changed files in this pull request and generated 1 comment.

Show a summary per file
FileDescription
src/snapshots/pdm__ui__tests__bitcoin_status_tab_peers_render.snapUpdates snapshot for the Peers tab to reflect new prompt/title rendering.
src/snapshots/pdm__ui__tests__bitcoin_status_screen_render.snapUpdates snapshot for Chain Info tab and includes assertion metadata change.
src/main.rsPolls Bitcoin chain info results each UI loop iteration.
src/components/p2pool_status_view.rsDeduplicates rendered live shares by blockhash and adds a test.
src/components/mod.rsExposes the new bitcoin_client module.
src/components/bitcoin_status_view.rsImplements Chain Info/Peers rendering using App’s Bitcoin chain info state and adds unit tests (chain info only).
src/components/bitcoin_client.rsNew Bitcoin Core RPC client for chain info + peer address retrieval, with mock-server tests.
src/app.rsAdds Bitcoin chain info state + async channel plumbing and triggers fetching when entering Bitcoin Status.
Suppressed comments (1)

src/components/bitcoin_status_view.rs:123

  • In the Peers tab, "Connected Peers" is derived from connected_peer_addresses.len(), which can be lower than the real peer count because getpeerinfo entries may omit/empty addr values. Since BitcoinChainInfo already carries connection_count (from getconnectioncount), use that when available to avoid displaying an incorrect count.
 } else if let Some(info) = &app.bitcoin_chain_info {
let mut lines = Vec::with_capacity(info.connected_peer_addresses.len() + 3);
lines.push(Line::from(format!(
"Connected Peers: {}",
info.connected_peer_addresses.len()
)));

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment on lines +112 to +118
fn render_peers(f: &mut Frame, app: &App, area: Rect) {
let text = if app.bitcoin_conf_path.is_none() {
vec![Line::from(Span::styled(
"Select a bitcoin.conf file to load Bitcoin Core peer info.",
Style::default().fg(Color::DarkGray),
))]
} else if let Some(info) = &app.bitcoin_chain_info {
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

@R27-pixel