Peers and bans: move queries and actions off the GUI thread #965

Open
opened 2026-10-02 17:29:26 +00:00 by johnny9 · 0 comments
johnny9 commented 2026-10-02 17:29:26 +00:00 (Migrated from github.com)

Parent: #921.

The Peers page polls statistics on the GUI thread. getNodesStats can wait for peer locks before its later TRY_LOCK(cs_main). Disconnect, ban, unban and ban-list refresh also enter backend code; ban changes can write to disk. These are source-confirmed blocking risks.

Fetch peer and ban data asynchronously and apply results on the Qt model thread. Limit pending work and avoid continuous polling while the view is inactive. Ignore obsolete results after navigation or shutdown.

Identify action targets by stable peer IDs, addresses or subnets, not row positions. Detail views must remain valid when a list refreshes. Coordinate related commands and refreshes so their results cannot overwrite newer state. Preserve ban-then-disconnect behavior and prevent duplicate submission.

Show pending state and report failures the backend exposes. Do not present an accepted ban as confirmed disk persistence when the API cannot report write failure.

Test delayed reads/actions, hidden and reopened pages, reordered or missing peers, expired bans, failures and shutdown during work. Verify GUI responsiveness and correct action targets.

Parent: #921. The Peers page [polls statistics on the GUI thread](https://github.com/bitcoin-core/gui-qml/blob/a91f4b4774f25de061fe1a7c132a91ddde117fca/qml/models/peerlistmodel.cpp#L108). `getNodesStats` can wait for peer locks before its later `TRY_LOCK(cs_main)`. Disconnect, ban, unban and ban-list refresh also enter backend code; ban changes can write to disk. These are source-confirmed blocking risks. Fetch peer and ban data asynchronously and apply results on the Qt model thread. Limit pending work and avoid continuous polling while the view is inactive. Ignore obsolete results after navigation or shutdown. Identify action targets by stable peer IDs, addresses or subnets, not row positions. Detail views must remain valid when a list refreshes. Coordinate related commands and refreshes so their results cannot overwrite newer state. Preserve ban-then-disconnect behavior and prevent duplicate submission. Show pending state and report failures the backend exposes. Do not present an accepted ban as confirmed disk persistence when the API cannot report write failure. Test delayed reads/actions, hidden and reopened pages, reordered or missing peers, expired bans, failures and shutdown during work. Verify GUI responsiveness and correct action targets.
Sign in to join this conversation.
No description provided.