Uh oh!
There was an error while loading. Please reload this page.
Show Bitcoin Core chain info in Bitcoin Status - #26
Conversation
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
There was a problem hiding this comment.
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+ optionalfallback_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.
| 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(), | ||
| }); | ||
| } |
| pub mod p2pool_config_view; | ||
| pub mod p2pool_status_view; | ||
| pub mod p2pool_websocket; | ||
| pub mod settings_view; |
There was a problem hiding this comment.
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.
| self.current_screen = screen; | ||
| if self.current_screen == CurrentScreen::BitcoinStatus { | ||
| self.fetch_bitcoin_chain_info(); | ||
| } |
There was a problem hiding this comment.
Update the wording from "polling" to "asynchronous background fetch".
68c1b05 to
cbc73e9Compare
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:
getblockchaininfoandgetconnectioncount