Skip to content

Show Bitcoin Core chain info in Bitcoin Status#26

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

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

Conversation

@R27-pixel

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

codecov Bot commented Jun 4, 2026

Copy link
Copy Markdown

@R27-pixel
R27-pixel marked this pull request as draft June 4, 2026 15:42
@R27-pixel
R27-pixel force-pushed the bitcoin_chaininfo branch from 80e4e85 to 371dd85 Compare July 8, 2026 16:55
@R27-pixel
R27-pixel marked this pull request as ready for review July 8, 2026 18:13
@pool2win
pool2win requested a review from Copilot July 13, 2026 09:22

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

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
File Description
src/snapshots/pdm__ui__tests__p2pool_status_screen_render.snap Update UI snapshot for new P2Pool “Shares” tab label.
src/snapshots/pdm__ui__tests__bitcoin_status_screen_render.snap Update UI snapshot for Bitcoin Status Chain Info prompt rendering.
src/p2poolv2_config.rs Minor test cleanup (remove unnecessary local binding).
src/main.rs Add additional per-tick polling drains; refactor event polling conditional.
src/config.rs Add ApiConfig defaults + optional fallback base URL.
src/components/p2pool_websocket.rs New websocket client for live P2Pool share/peer event streaming (+ tests).
src/components/p2pool_status_view.rs Add Shares tab UI (table), live peer events display, formatting helpers (+ tests).
src/components/p2pool_config_view.rs Minor refactors in config rendering tests and flattening call site.
src/components/p2pool_client.rs Add recent shares endpoint + REST fallback logic + websocket client builder (+ tests).
src/components/mod.rs Export new bitcoin_client and p2pool_websocket modules.
src/components/file_explorer.rs Test refactor using Option::is_none_or.
src/components/bitcoin_status_view.rs Implement Chain Info rendering states and formatting helpers (+ tests).
src/components/bitcoin_client.rs New Bitcoin Core JSON-RPC client with config parsing + cookie/basic auth (+ tests).
src/app.rs Add Bitcoin chain info state + background fetch wiring; add P2Pool shares/live stream state + wiring (+ tests).
dummy.toml Remove dummy config file from repo root.
config/config.toml Add api.base_url and example fallback_base_url.
Cargo.toml Add websocket/base64/url/serde_json dependencies.
Cargo.lock Lockfile 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
Contributor Author

Choose a reason for hiding this comment

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

fixed!!

Comment thread src/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-pixel R27-pixel Jul 15, 2026

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.

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 thread src/app.rs
Comment on lines 332 to +335
self.current_screen = screen;
if self.current_screen == CurrentScreen::BitcoinStatus {
self.fetch_bitcoin_chain_info();
}

@R27-pixel R27-pixel Jul 15, 2026

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.

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

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.

2 participants