Skip to content

Bitcoin peers - #27

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

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

Conversation

@R27-pixel

@R27-pixel R27-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

codecov Bot commented Jun 16, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 96.43678% with 31 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
src/components/bitcoin_client.rs 96.03% 20 Missing ⚠️
src/app.rs 91.96% 9 Missing ⚠️
src/components/bitcoin_status_view.rs 99.57% 1 Missing ⚠️
src/main.rs 0.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

Copilot AI 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
File Description
src/snapshots/pdm__ui__tests__bitcoin_status_tab_peers_render.snap Updates snapshot for the Peers tab to reflect new prompt/title rendering.
src/snapshots/pdm__ui__tests__bitcoin_status_screen_render.snap Updates snapshot for Chain Info tab and includes assertion metadata change.
src/main.rs Polls Bitcoin chain info results each UI loop iteration.
src/components/p2pool_status_view.rs Deduplicates rendered live shares by blockhash and adds a test.
src/components/mod.rs Exposes the new bitcoin_client module.
src/components/bitcoin_status_view.rs Implements Chain Info/Peers rendering using App’s Bitcoin chain info state and adds unit tests (chain info only).
src/components/bitcoin_client.rs New Bitcoin Core RPC client for chain info + peer address retrieval, with mock-server tests.
src/app.rs Adds 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 {

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Added unit tests for the peers tab.

@pool2win

Copy link
Copy Markdown
Contributor

We don't need this, we should instead show the peers in p2poolv2 connections.

Sign up for free to 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.

3 participants