Skip to content

Show Bitcoin Core chain info in Bitcoin Status - #26

Open
R27-pixel wants to merge 3 commits into
p2poolv2:mainfrom
R27-pixel:bitcoin_chaininfo
Open

Show Bitcoin Core chain info in Bitcoin Status#26
R27-pixel wants to merge 3 commits into
p2poolv2:mainfrom
R27-pixel:bitcoin_chaininfo

Conversation

@R27-pixel

@R27-pixelR27-pixel commented Jun 4, 2026

Copy link
Copy Markdown
Contributor

Description

Adds the first Bitcoin Status phase by fetching basic Bitcoin Core chain information via JSON-RPC and rendering it in the Chain Info tab.

Changes include:

  • Added a small Bitcoin Core RPC client for getblockchaininfo and getconnectioncount
  • Added Bitcoin chain info state and asynchronous background fetch wiring
  • Updated the Bitcoin Status Chain Info UI with loading, missing-config, and error states
image

@codecov

codecovBot commented Jun 4, 2026

Copy link
Copy Markdown

Codecov Report

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

Files with missing linesPatch %Lines
src/components/bitcoin_client.rs95.43%20 Missing ⚠️
src/app.rs91.66%9 Missing ⚠️
src/components/bitcoin_status_view.rs99.13%1 Missing ⚠️
src/main.rs0.00%1 Missing ⚠️

📢 Thoughts on this report? Let us know!

@R27-pixel
R27-pixel marked this pull request as draft June 4, 2026 15:42
@R27-pixel
R27-pixel marked this pull request as ready for review July 8, 2026 18:13
@pool2win
pool2win requested a review from CopilotJuly 13, 2026 09:22

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

This PR adds initial Bitcoin Core “Chain Info” support to the Bitcoin Status UI by introducing a JSON-RPC client, background fetching, and render states. It also expands the P2Pool Status surface area with shares/live websocket functionality and introduces API base-url/fallback configuration.

Changes:

  • Add a Bitcoin Core JSON-RPC client (getblockchaininfo, getconnectioncount) and render Chain Info with loading/error/missing-config states.
  • Add API configuration support for base_url + optional fallback_base_url, and implement HTTP fallback logic for P2Pool REST calls.
  • Add P2Pool “Shares” tab and a websocket client to stream live share/peer events into the UI.

Reviewed changes

Copilot reviewed 17 out of 18 changed files in this pull request and generated 3 comments.

Show a summary per file
FileDescription
src/snapshots/pdm__ui__tests__p2pool_status_screen_render.snapUpdate UI snapshot for new P2Pool “Shares” tab label.
src/snapshots/pdm__ui__tests__bitcoin_status_screen_render.snapUpdate UI snapshot for Bitcoin Status Chain Info prompt rendering.
src/p2poolv2_config.rsMinor test cleanup (remove unnecessary local binding).
src/main.rsAdd additional per-tick polling drains; refactor event polling conditional.
src/config.rsAdd ApiConfig defaults + optional fallback base URL.
src/components/p2pool_websocket.rsNew websocket client for live P2Pool share/peer event streaming (+ tests).
src/components/p2pool_status_view.rsAdd Shares tab UI (table), live peer events display, formatting helpers (+ tests).
src/components/p2pool_config_view.rsMinor refactors in config rendering tests and flattening call site.
src/components/p2pool_client.rsAdd recent shares endpoint + REST fallback logic + websocket client builder (+ tests).
src/components/mod.rsExport new bitcoin_client and p2pool_websocket modules.
src/components/file_explorer.rsTest refactor using Option::is_none_or.
src/components/bitcoin_status_view.rsImplement Chain Info rendering states and formatting helpers (+ tests).
src/components/bitcoin_client.rsNew Bitcoin Core JSON-RPC client with config parsing + cookie/basic auth (+ tests).
src/app.rsAdd Bitcoin chain info state + background fetch wiring; add P2Pool shares/live stream state + wiring (+ tests).
dummy.tomlRemove dummy config file from repo root.
config/config.tomlAdd api.base_url and example fallback_base_url.
Cargo.tomlAdd websocket/base64/url/serde_json dependencies.
Cargo.lockLockfile updates for new dependencies.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +225 to +235
for share in app.live_shares.iter().rev() {
seen.insert(share.blockhash.clone());
entries.push(ShareTableEntry {
height: share.height,
blockhash: share.blockhash.clone(),
miner: share.miner_address.clone(),
bits: share.bits.clone(),
timestamp: share.timestamp,
uncles: share.uncles.len(),
});
}

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

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

fixed!!

Comment threadsrc/components/mod.rs
Comment on lines 13 to 16
pub mod p2pool_config_view;
pub mod p2pool_status_view;
pub mod p2pool_websocket;
pub mod settings_view;

@R27-pixelR27-pixelJul 15, 2026

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

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

This is a stacked PR, so the websocket client, Shares tab, and API configuration changes come from the parent PR. This PR itself is focused on the Bitcoin Status chain info functionality.

Comment threadsrc/app.rs
Comment on lines 332 to +335
self.current_screen = screen;
if self.current_screen == CurrentScreen::BitcoinStatus {
self.fetch_bitcoin_chain_info();
}

@R27-pixelR27-pixelJul 15, 2026

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

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

Update the wording from "polling" to "asynchronous background fetch".

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