qt: add Peers sub-tab in Text Based Worship — port from Bitcoin Core 0.10 #13
Labels
No labels
enhancement
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
SubGeniusFinance/Offerings-to-Cthulhu#13
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Why
Today, to see who your OFF wallet is talking to, you have to:
Help → Text Based Worship → ConsolegetpeerinfoEvery other Bitcoin-Core-descended wallet of comparable vintage ships a Peers tab in the Debug Window: a live
QTableViewof connected peers (address, subversion, ping), with a per-peer detail pane below (connection direction, services, traffic, starting height, last send/recv, ban score, etc.). It's the single most useful operator-facing screen in the wallet.OFF doesn't have it. The ancestor codebase (thegreatoldone's v1.6.2) appears to have been forked from upstream before the Peers tab landed and never picked it up. The sibling (BOB) / Dobbscoin wallet of the same 0.10-fork lineage has it — see
dobbscoin-source/src/qt/peertablemodel.{cpp,h}and the correspondingtab_peerswidget inrpcconsole.ui.This issue is the port of that tab into OFF.
What's already in place
The good news: the entire backend data plumbing already exists in OFF. No
net.cpp/main.cppchanges are required.CNodeStatssrc/net.h:127CNode::copyStats(CNodeStats&)src/net.cpp:493CNodeStateStatssrc/main.h:214GetNodeStateStats(NodeId, CNodeStateStats&)src/main.cpp:324NodeIdtypedefsrc/net.h:58nLastNodeIdsrc/net.h:116So this is a Qt-only patch. The
PeerTableModelreads from APIs that already exist.Placement: fourth sub-tab inside Text Based Worship
The
QTabWidgetatsrc/qt/forms/rpcconsole.ui:18(namedtabWidget) currently holds three sub-tabs:After this issue lands, four:
(Note: there's an open companion issue #8 proposing a fifth — Mining — for post-Codex. The two tabs are independent and can land in any order. The natural reading-order of the sub-tabs once both are present is Information / Console / Network Traffic / Peers / Mining.)
Reference layout — what the tab looks like
Mirror upstream / (BOB):
QTableView peerWidgetshowing all connected peers, three columns:Address(e.g.185.197.251.40:48146)Subversion(e.g./Offerings:2.0.5/)Ping(latency in ms, or0if not yet measured)on_tabWidget_currentChangedhook atsrc/qt/rpcconsole.cpp:436).nVersion, e.g.90003)pindexBestKnownBlock->nHeightif known)When no peer selected, the detail pane stays greyed/empty.
Implementation plan
New files (copy-and-rename from (BOB),
s/DOBBSCOIN_/OFFERINGS_/):src/qt/peertablemodel.h—QAbstractTableModelsubclass exposing the live peer list. Mirrordobbscoin-source/src/qt/peertablemodel.h(~80 LOC).src/qt/peertablemodel.cpp— model implementation:refresh()slot pollsvNodes+GetNodeStateStats(), populatesCNodeCombinedStatsrows, emitsdataChanged. Mirrordobbscoin-source/src/qt/peertablemodel.cpp(~240 LOC).Modified files:
src/qt/forms/rpcconsole.ui— add a<widget class=\"QWidget\" name=\"tab_peers\">block totabWidget. Inside: aQSplitterwithpeerWidget(QTableView) on top and aQGroupBox name=\"peerHeading\"of detail labels on the bottom. ~250 lines of.uimarkup; pattern copies cleanly fromdobbscoin-source/src/qt/forms/rpcconsole.uiat thetab_peerswidget. Same PR: opportunistic cleanup — renamewindowTitleatrpcconsole.ui:14fromDebug windowtoText Based Worship, matching the menu action atbitcoingui.cpp:314.src/qt/rpcconsole.h— declarepeerSelected(const QItemSelection&, const QItemSelection&)slot andupdateNodeDetail(const CNodeCombinedStats*)helper. Also declare aclientModelmember if not already cached.src/qt/rpcconsole.cpp— insetClientModel()at line 264, wireui->peerWidget->setModel(model->getPeerTableModel()), configure column widths/sort behavior, connect the selection model'sselectionChangedsignal to the new slot. Extendon_tabWidget_currentChanged()at line 436 to callstartAutoRefresh()/stopAutoRefresh()on the peer model when entering/leaving the Peers tab (mirrors the existing console/nettraffic polling pattern).src/qt/clientmodel.handsrc/qt/clientmodel.cpp— addPeerTableModel *peerTableModelmember, instantiate in the ClientModel constructor, expose viagetPeerTableModel()accessor.src/qt/Makefile.am(orMakefile.qt.includeper OFF's autotools layout) — addpeertablemodel.cpptobitcoin_qt_SOURCESandpeertablemodel.hto theBITCOIN_QT_Hlist. Regenerate thebitcoin_qt.qrcMOC manifest if applicable.Net delta: ~320 LOC C++/Qt + ~250 lines
.uimarkup. No backend changes. No consensus impact. No fork.Trade-offs / What this isn't
vNodes,GetNodeStateStats) under the existing locks (cs_vNodes,cs_main); no new attack surface on the network layer.getpeerinfopath still works. This is operator-quality-of-life, not a missing critical feature. Could land in v2.1.x or v2.2.x; doesn't block the post-Codex v2.1.0 release.Worth doing now, specifically
With the
PROTOCOL_VERSION80002 → 90003 era bump now live, the Peers tab becomes more useful than it would have been pre-Restoration: at a glance, the operator can see which connected peers are still on80001(pre-Restoration nodes, candidates for the futureMIN_PEER_PROTO_VERSIONeviction lever) vs.90003(post-Restoration). Today that data is buried ingetpeerinfoJSON; the Peers tab surfaces it in theVersioncolumn of the detail pane and in theSubversioncolumn of the table.Reference behavior to mirror
dobbscoin-source/src/qt/peertablemodel.{cpp,h}— drop-in template, change the include guard fromDOBBSCOIN_QT_PEERTABLEMODEL_HtoOFFERINGS_QT_PEERTABLEMODEL_Hdobbscoin-source/src/qt/forms/rpcconsole.ui—<widget class=\"QWidget\" name=\"tab_peers\">block as the layout templatedobbscoin-source/src/qt/rpcconsole.cpp::setClientModel— wiring pattern (table view ↔ model, selection signal ↔ detail-update slot)NodeStatsmodel, PR #5288 added the Peers tab; both pre-date the 0.10 release that OFF's lineage descends fromOpen questions (decide in PR review)
currentChangedstart/stop hook.Address / Subversion / Ping. Upstream later addedNetNodeId. Worth including for OFF where node-ID-based ban tracking matters? My lean: keep minimum for v1 of this tab, add NetNodeId column in a follow-up.Disconnect Node/Ban Node/Copy Address? My lean: detail-pane only for v1; context menu in a follow-up PR.References
src/qt/forms/rpcconsole.ui:18—QTabWidget name=\"tabWidget\"(integration point)src/qt/forms/rpcconsole.ui:14—windowTitle = \"Debug window\"(rebrand cleanup candidate, same PR)src/qt/rpcconsole.cpp:264::setClientModel— wiring pointsrc/qt/rpcconsole.cpp:436::on_tabWidget_currentChanged— visible-tab polling hooksrc/qt/clientmodel.{cpp,h}— needsgetPeerTableModel()accessorsrc/net.h:127::CNodeStats,src/net.cpp:493::CNode::copyStats— data sourcesrc/main.h:214::CNodeStateStats,src/main.cpp:324::GetNodeStateStats— supplementary data sourcedobbscoin-source/src/qt/peertablemodel.*anddobbscoin-source/src/qt/forms/rpcconsole.uiEven the Great Old One keeps a guest list. Iä Iä.
Tested end-to-end on the merge commit (
d8cfdf5):windowTitlereads "Text Based Worship" as intended.windows-build-depends.yml, Qt 5.15.16 / GCC 13-posix / depends/ cross-compile): same — Peers tab present and functional.The post-fork visibility argument holds up in practice: with
PROTOCOL_VERSIONnow at 90003, the Peers tab makes pre-Restoration (80001) vs post-Restoration (90003) peers immediately legible in the Version column of the detail pane — nogetpeerinfoscraping required.Deferred to follow-ups (as flagged in the issue's open questions):
nSyncHeightadded toCNodeStateStatsfirst, which is a backend touch and out of scope hereClosing on next sync via the
closes #13trailer ind8cfdf5.The guest list is now visible. Iä Iä.