Node information: display cached data and refresh asynchronously #963

Open
opened 2026-10-02 17:29:18 +00:00 by johnny9 · 1 comment
johnny9 commented 2026-10-02 17:29:18 +00:00 (Migrated from github.com)

Parent: #576.

Opening Node information can stop the GUI while it reads live backend state. A chain-lock wait was observed during initial block download. Row construction calls getHeaderTip, getNumBlocks, getLastBlockTime, getNetLocalAddresses, shared path/settings getters and getNetworkActive.

Build rows from cached values and refresh them asynchronously. Opening the popup should show available data immediately, with a clear unavailable state before the first result. Repeated openings must not create unbounded backend work. Ignore results that no longer match the active node or application state.

Reuse shared chain, network, connection and warning data where practical. Keep GUI getters and completion callbacks free of backend queries, including fallback paths. Remove unused byte-counter APIs or make them follow the same cached-read contract. Preserve existing worker coverage for traffic, mempool and debug-log reads.

Test opening and reopening the popup while a backend read is blocked. Cover startup, empty results, newer notifications during a read, backend errors and shutdown. Verify GUI responsiveness and repeat the popup action during initial block download.

Parent: #576. Opening Node information can stop the GUI while it reads live backend state. A chain-lock wait was observed during initial block download. [Row construction](https://github.com/bitcoin-core/gui-qml/blob/a91f4b4774f25de061fe1a7c132a91ddde117fca/qml/models/nodemodel.cpp#L648) calls `getHeaderTip`, `getNumBlocks`, `getLastBlockTime`, `getNetLocalAddresses`, shared path/settings getters and `getNetworkActive`. Build rows from cached values and refresh them asynchronously. Opening the popup should show available data immediately, with a clear unavailable state before the first result. Repeated openings must not create unbounded backend work. Ignore results that no longer match the active node or application state. Reuse shared chain, network, connection and warning data where practical. Keep GUI getters and completion callbacks free of backend queries, including fallback paths. Remove unused byte-counter APIs or make them follow the same cached-read contract. Preserve existing worker coverage for traffic, mempool and debug-log reads. Test opening and reopening the popup while a backend read is blocked. Cover startup, empty results, newer notifications during a read, backend errors and shutdown. Verify GUI responsiveness and repeat the popup action during initial block download.
jarolrod commented 2026-11-06 17:42:21 +00:00 (Migrated from github.com)

The cached node information also needs to handle the best header moving backwards. On merged qt6 at 6e54a48ab571, invalidateblock leaves QML displaying a header that Core has discarded.

In isolated regtest:

  1. Mine 200 blocks and wait for the GUI to show it is caught up.
  2. Invalidate the block at height 171.
  3. Core reports blocks: 170, headers: 170 and initialblockdownload: false. Node information shows Block height 170 but Header height 200, retaining the invalid tip's header time.
  4. With a connected local test peer, the block clock remains at 99.9% / Estimating, and its tooltip says Downloading blocks.

A 20-block rewind still leaves the stale header row, but does not trigger the stuck synchronization display. Reconsidering the invalidated block, mining a new valid block, or restarting restores the correct state.

The header cache is updated from header notifications and the startup snapshot. The block-tip update does not refresh it after invalidation, so synchronization completion can keep waiting for the discarded header. Current #985 and #994 source still retain this gap; those PR builds were not runtime-tested here.

Please reconcile the cached best header after invalidation through the asynchronous refresh path, and cover both the information rows and synchronization completion. This reproduction uses the explicit debug RPC; it does not establish that ordinary reorganizations cause the same symptom.

The cached node information also needs to handle the best header moving backwards. On merged `qt6` at `6e54a48ab571`, `invalidateblock` leaves QML displaying a header that Core has discarded. In isolated regtest: 1. Mine 200 blocks and wait for the GUI to show it is caught up. 2. Invalidate the block at height 171. 3. Core reports `blocks: 170`, `headers: 170` and `initialblockdownload: false`. Node information shows Block height 170 but Header height 200, retaining the invalid tip's header time. 4. With a connected local test peer, the block clock remains at **99.9% / Estimating**, and its tooltip says **Downloading blocks**. A 20-block rewind still leaves the stale header row, but does not trigger the stuck synchronization display. Reconsidering the invalidated block, mining a new valid block, or restarting restores the correct state. The header cache is updated from header notifications and the startup snapshot. The block-tip update does not refresh it after invalidation, so synchronization completion can keep waiting for the discarded header. Current #985 and #994 source still retain this gap; those PR builds were not runtime-tested here. Please reconcile the cached best header after invalidation through the asynchronous refresh path, and cover both the information rows and synchronization completion. This reproduction uses the explicit debug RPC; it does not establish that ordinary reorganizations cause the same symptom.
Sign in to join this conversation.
No description provided.