Review report

bitcoin-core/gui-qml: PR #933

1 major finding · 3 minor findings · 3 suggestions

Findings

Link

[major] · Front trimming can retarget a resting hover toolbar

At the 50,000-line cap, front trimming can leave the hover toolbar targeting a different entry if it remains under the pointer, allowing Run again or Copy to act on the replacement row.

Location: qml/components/MonospaceOutputView.qml:492 (head).

Details and suggested fix

_onRowsShifted() clears selection indices but leaves _hoveredRow unchanged. _onRowsChanged() clears _hoverBounds, moving the still-active toolbar to y=0, while _updateHover() refuses to repair its index whenever actionsHover.hovered remains true. A toolbar previously near the top can therefore remain under a resting pointer through removal and tail scrolling. With a full buffer, clicking Run again appends a request and reply that trim front rows. onResultReady() then re-enables execution. If the retained index now contains another non-redacted command, a second click submits that command against the current wallet; Copy likewise reads the replacement entry. A historical spending command remains subject to Core's normal wallet, unlock and signing checks. This overlap-dependent interaction has not been reproduced; moving the toolbar out from under the pointer repairs hover normally. Reset _hoveredRow and _hoverBounds unconditionally in _onRowsShifted() so the Loader unloads, and add a regression test that trims while the pointer rests on a top-positioned toolbar.


Link

[minor] · The output context menu outlives the active console

Navigation without an outside press, such as through the native menu bar, can leave the console's output menu open and actionable over the next page.

Location: qml/pages/node/CommandConsole.qml:223 (head).

Details and suggested fix

outputMenu renders as an overlay Popup, but onTabActiveChanged closes only autocompletePopup. The Network Traffic native-menu route hides and retains the console's settings section without delivering a press inside the Qt window, so the default outside-press policy does not dismiss the output menu. Its Run again, Copy and Clear console actions still refer to the hidden console. Escape or a later outside click recovers, and the existing row-trim guard remains effective. Call closeOutputMenu() alongside autocompletePopup.close() when tabActive becomes false. Add a test that opens the menu, changes section without an outside press, and checks both closure and reset of its row.


Link

[minor] · Front trimming silently leaves partial output entries

Once the line buffer is full, eviction can remove a reply's prefix while Copy output and Select output treat the unmarked remainder as the complete entry.

Location: qml/models/rpcconsolemodel.cpp:90 (head).

Details and suggested fix

appendLines() removes exactly m_rows.size() + keep - kMaxRows front lines, which can cut through the oldest multi-line reply. Unlike the base's whole-reply eviction, this leaves a tail with the original entry id but without its first-line timestamp or a truncation marker. entryTextAt() and selectEntryAt() find only the surviving bounds, so entry-level actions silently copy or select that tail. This affects the oldest entry after the 50,000-line cap is reached. Trim through the next entry boundary, or include a truncation notice in the retained entry's displayed and copied text. Add a regression case where eviction intersects an existing multi-line entry.


Link

[minor] · An oversized output block loses its timestamp

When one block exceeds kMaxRows lines, insertion skips index zero, so the timestamp condition never stamps any retained row.

Location: qml/models/rpcconsolemodel.cpp:102 (head).

Details and suggested fix

appendLines() deliberately retains the tail of an oversized block, starting its loop at skipped. It nevertheless attaches the timestamp only when i == 0. Compare i == skipped instead so the first retained row receives the timestamp. The existing truncation fixture exercises only a long line plus a notice, not this branch. Successful results are capped at 50,000 characters, so triggering this through a reply needs output made almost entirely of newlines, or a sufficiently large multi-line error that bypasses that cap. No current RPC producing such output was identified, so production impact is unconfirmed.


Optional improvements

Link

[suggestion] · One-click replay does not identify its wallet target

Run again immediately submits a historical command against the currently active wallet, but the entry retains no original wallet and the action does not name its current target.

Location: qml/pages/node/CommandConsole.qml:186 (head).

Details and suggested fix

The retained settings console follows activeWalletName, and runCommandAt() reads root.walletName when clicked. After switching from wallet A to B, replaying an entry originally submitted under A therefore targets B. The wallet notice appears only during submission, after activation. Unlike history recall, replay does not first place the command in the input for an explicit Enter. Redaction and execution guards do not exclude state-changing RPCs such as sendtoaddress; Core's wallet lookup and spending unlock checks still apply. Make the replay contract explicit before activation. If current-wallet replay is intended, name that wallet in the action or tooltip and require confirmation when it differs from the recorded original context. Alternatively, bind replay to the original wallet with defined unavailable-wallet behavior. Add switch and unload cases; the existing current-wallet test keeps w1 selected throughout.


Link

[suggestion] · The line cap does not enforce the stated text-size bound

The 50,000-line limit does not bound retained text to approximately 12 MB, because large single-line replies consume very few rows.

Location: qml/models/rpcconsolemodel.h:53 (head).

Details and suggested fix

appendLines() evicts by line count only. A successful scalar result can contain 50,000 characters on one line, with a second line added if truncated, and each retained row carries HTML and plain-text representations. Thousands of these replies can therefore remain in the buffer. For request/reply pairs using two or three rows, roughly 16,000 to 25,000 replies fit, substantially more than under the base's 5,000-row cap. This is an unusual workload, but virtualization does not bound its retained text. Track retained characters alongside the row limit if a size budget is required, or revise the approximately 12 MB comment so it does not present a workload estimate as an enforced bound.


Link

[suggestion] · Search constructs a seven-role map for every scanned row

An active-search refresh visits up to 50,000 rows on the GUI thread and constructs a full role map for each row just to read plainContent.

Location: qml/components/MonospaceOutputView.qml:380 (head).

Details and suggested fix

Scanning model data is necessary because off-screen delegates do not exist, but _plainTextOf() obtains it through get(), which builds a seven-entry QVariantMap for QML access. Search-text changes and output insertions or removals schedule a full scan while search is active. The zero-interval timer coalesces notifications, but a full buffer still requires 50,000 map constructions per completed refresh. The runtime cost is unmeasured, and the supplied benchmarks cover scrolling rather than full-buffer search. Expose a plain-text-only accessor such as Q_INVOKABLE QString plainTextAt(int row) and prefer it here, retaining get() as a fallback for QML ListModels. That avoids unrelated role-map work without changing rendered-text offsets or literal, case-insensitive matching.


Coverage details