qt: Disconnect right-click action on Peers tab (Qt-only) #16

Closed
opened 2026-06-06 22:58:47 +00:00 by dobbscoin · 1 comment
dobbscoin commented 2026-06-06 22:58:47 +00:00

Follow-up to #13. Adds Disconnect Node to the right-click menu on the Peers tab.

Implementable as a pure-Qt change — no net.cpp modifications needed because the existing CNode::CloseSocketDisconnect() API and fDisconnect flag (src/net.cpp:414) already do what's needed. Iterating vNodes under cs_vNodes from Qt code is the standard pattern.

Freeze-cliff-safe: Offeringsd doesn't link src/qt/*, so this can land any time.

Why

Operator quality-of-life. When a peer is misbehaving — flooding invs, hanging at the wrong tip, or just being slow — the wallet operator should be able to drop them in one click rather than scripting around Offerings-cli (which would need a disconnectnode RPC that OFF doesn't currently have).

For the Restoration window specifically: as the chain runs up to block 999,991, being able to drop the camped attacker's node from a wallet GUI is a low-friction defensive lever. The eviction lever via MIN_PEER_PROTO_VERSION (see #12 / #15 protocol-version discussion) is the cluster-wide answer; this is the single-operator answer.

Implementation

Builds on the right-click context-menu plumbing landed in #15 (Copy Address). After that issue lands, the menu construction is already there — this issue adds one more QAction.

  • src/qt/rpcconsole.h: declare disconnectNode() slot
  • src/qt/rpcconsole.cpp::setClientModel(): add Disconnect Node action to contextMenu, connect to slot
  • src/qt/rpcconsole.cpp::disconnectNode():
    LOCK(cs_vNodes);
    CNode *pnode = FindNode(cachedNodeid);  // or iterate vNodes
    if (pnode) {
        pnode->fDisconnect = true;
        // The socket-handler thread closes the connection on next tick;
        // PeerTableModel::refresh picks up the disappearance automatically.
    }
    

FindNode(NodeId) may not exist in OFF — verify; if missing, inline the vNodes iteration (4 lines).

~30 LOC.

Trade-offs / What this isn't

  • Not a ban. Disconnect is one-shot; the peer can re-connect immediately (via addrman). Permanent rejection requires a banlist module — that's a separate epic.
  • Not consensus-changing, not network-protocol-changing.
  • No RPC added. This is a Qt-only convenience; CLI users don't get an equivalent. Adding disconnectnode RPC would be a separate small follow-up if anyone wants it.

Order of operations

Depends on #15 landing first (right-click menu plumbing). After #15 is merged, this is a ~30-min change.

Reference behavior

  • src/net.cpp:414::CNode::CloseSocketDisconnect — the existing disconnect API
  • src/net.cpp::vNodes — the connected-peer list, protected by cs_vNodes
  • (BOB) / dobbscoin-source/src/qt/rpcconsole.cpp::disconnectNode — pattern to mirror

The Slumbering Lord permits banishment of one Outsider at a time. Iä Iä.

Follow-up to #13. Adds **Disconnect Node** to the right-click menu on the Peers tab. **Implementable as a pure-Qt change** — no `net.cpp` modifications needed because the existing `CNode::CloseSocketDisconnect()` API and `fDisconnect` flag (`src/net.cpp:414`) already do what's needed. Iterating `vNodes` under `cs_vNodes` from Qt code is the standard pattern. Freeze-cliff-safe: `Offeringsd` doesn't link `src/qt/*`, so this can land any time. ## Why Operator quality-of-life. When a peer is misbehaving — flooding `inv`s, hanging at the wrong tip, or just being slow — the wallet operator should be able to drop them in one click rather than scripting around `Offerings-cli` (which would need a `disconnectnode` RPC that OFF doesn't currently have). For the Restoration window specifically: as the chain runs up to block 999,991, being able to drop the camped attacker's node from a wallet GUI is a low-friction defensive lever. The eviction lever via `MIN_PEER_PROTO_VERSION` (see #12 / #15 protocol-version discussion) is the cluster-wide answer; this is the single-operator answer. ## Implementation Builds on the right-click context-menu plumbing landed in #15 (Copy Address). After that issue lands, the menu construction is already there — this issue adds one more `QAction`. - `src/qt/rpcconsole.h`: declare `disconnectNode()` slot - `src/qt/rpcconsole.cpp::setClientModel()`: add `Disconnect Node` action to `contextMenu`, connect to slot - `src/qt/rpcconsole.cpp::disconnectNode()`: ``` LOCK(cs_vNodes); CNode *pnode = FindNode(cachedNodeid); // or iterate vNodes if (pnode) { pnode->fDisconnect = true; // The socket-handler thread closes the connection on next tick; // PeerTableModel::refresh picks up the disappearance automatically. } ``` `FindNode(NodeId)` may not exist in OFF — verify; if missing, inline the `vNodes` iteration (4 lines). ~30 LOC. ## Trade-offs / What this isn't - **Not a ban.** Disconnect is one-shot; the peer can re-connect immediately (via addrman). Permanent rejection requires a banlist module — that's a separate epic. - **Not consensus-changing**, **not network-protocol-changing**. - **No RPC added.** This is a Qt-only convenience; CLI users don't get an equivalent. Adding `disconnectnode` RPC would be a separate small follow-up if anyone wants it. ## Order of operations Depends on #15 landing first (right-click menu plumbing). After #15 is merged, this is a ~30-min change. ## Reference behavior - `src/net.cpp:414::CNode::CloseSocketDisconnect` — the existing disconnect API - `src/net.cpp::vNodes` — the connected-peer list, protected by `cs_vNodes` - (BOB) / `dobbscoin-source/src/qt/rpcconsole.cpp::disconnectNode` — pattern to mirror --- *The Slumbering Lord permits banishment of one Outsider at a time. Iä Iä.*
dobbscoin closed this issue 2026-06-06 23:34:50 +00:00
dobbscoin commented 2026-06-06 23:45:18 +00:00

Tested end-to-end on the merge commit (7dc714d):

  • Linux x86_64 (local Qt5 build, stripped): right-clicking a row in the peers table shows Copy address + a separator + Disconnect Node. Triggering Disconnect drops the connection — the row disappears from the table within a refresh tick once the socket-handler thread acts on fDisconnect.
  • Windows x86_64 (CI artifact from windows-build-depends.yml): same. Menu and disconnect behavior identical to Linux.

Expected behavior: a disconnected peer can immediately reconnect via addrman — this is one-shot disconnect, not a ban. Permanent rejection requires the banlist module from #17 (post-Codex).

Closes on next sync via the closes #16 trailer in 7dc714d.


One Outsider banished. Iä Iä.

Tested end-to-end on the merge commit (`7dc714d`): - **Linux x86_64** (local Qt5 build, stripped): right-clicking a row in the peers table shows `Copy address` + a separator + `Disconnect Node`. Triggering Disconnect drops the connection — the row disappears from the table within a refresh tick once the socket-handler thread acts on `fDisconnect`. - **Windows x86_64** (CI artifact from `windows-build-depends.yml`): same. Menu and disconnect behavior identical to Linux. Expected behavior: a disconnected peer can immediately reconnect via addrman — this is one-shot disconnect, not a ban. Permanent rejection requires the banlist module from #17 (post-Codex). Closes on next sync via the `closes #16` trailer in `7dc714d`. --- *One Outsider banished. Iä Iä.*
Sign in to join this conversation.
No labels
enhancement
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
SubGeniusFinance/Offerings-to-Cthulhu#16
No description provided.