Review report

bitcoin/bitcoin: PR #36481

3 minor findings · 7 suggestions

Earlier concerns neither republished nor resolved: 3 minor findings · 1 suggestion. See the Run archive for their assessments.

Findings

Link

[minor] · Some rebroadcast failures return an empty error message

Fee-cap failures and some confirmations racing wallet notifications produce RPC_MISC_ERROR or a “Rebroadcast Failed” dialog without explanatory text.

Location: src/wallet/wallet.cpp:1844 (head).

Details and suggested fix

RebroadcastSingleTransaction starts with an empty err, but BroadcastTransaction returns MAX_FEE_EXCEEDED, MAX_FEE_RATE_EXCEEDED, and ALREADY_IN_UTXO_SET without filling it. The chain adapter reduces the result to false, so the new RPC and GUI lose the reason. An otherwise acceptable transaction absent from the mempool can reach this when it exceeds the wallet's positive -maxtxfee or -maxfeerate, including incoming payments or transactions created before the caps were lowered. A confirmation racing the wallet notification can also reach the UTXO-set return. In the chain adapter, fill empty failure details from TransactionErrorString before discarding the enum. Add a fee-cap rejection test using an evicted transaction. The default caps of 0.1 BTC and 0.1 BTC/kvB make the fee case uncommon unless lowered; no production occurrence was identified.


Link

[minor] · Rebroadcast RPC checks eligibility against stale wallet chain state

rebroadcastwallettx can transiently reject an eligible transaction because it does not wait for queued wallet block notifications.

Location: src/wallet/rpc/transactions.cpp:1103 (head).

Details and suggested fix

TransactionCanBeBroadcast checks confirmation and conflict depth using the transaction's stored wallet state and GetLastBlockHeight(). If a block-disconnection notification is still queued, a transaction no longer confirmed in the active chain can remain TxStateConfirmed and be rejected before submission. Conversely, a queued connection can let a newly confirmed transaction pass eligibility and fail later with ALREADY_IN_UTXO_SET and an empty message. Retrying after the notifications drain resolves the stale-state problem. Call wallet->BlockUntilSyncedToCurrentChain() before RebroadcastSingleTransaction, without holding cs_wallet, as abandontransaction does.


Link

[minor] · Rebroadcast indexes a selection that can disappear while its menu is open

If the selected row disappears while the context menu is open, triggering Rebroadcast reads past an empty list and can crash the GUI.

Location: src/qt/transactionview.cpp:403 (head).

Details and suggested fix

contextualMenu() checks the selection before opening a nonblocking QMenu::popup, but rebroadcastTx() fetches it again and immediately calls selection.at(0) and the parsed txid's .value(). A pending 200 ms search or amount filter can hide the selected row while the menu remains open; a CT_DELETED update can also remove it. The action remains enabled despite the empty selection. Return early if the freshly fetched selection is empty, and check the optional txid as contextualMenu() does. The older abandon and bump slots share this pattern, but this action adds another unguarded instance. No production occurrence was identified.


Optional improvements

Link

[suggestion] · GUI rebroadcast omits the RPC's privacy warning

The GUI initiates all-peer relay of received or sent payments without showing the sender/receiver privacy warning included in the RPC help.

Location: src/qt/transactionview.cpp:407 (head).

Details and suggested fix

Clicking Rebroadcast immediately calls the wallet operation with MEMPOOL_AND_BROADCAST_TO_ALL; the slot displays a dialog only on failure. Eligibility allows received payments as well as sent ones. The RPC help warns that rebroadcasting may reveal the node's involvement as sender or receiver, but this workflow never shows that warning. Add a confirmation dialog containing the same warning and a cancel option before submission. A short success notification would also make the result visible when submission succeeds.


Link

[suggestion] · Manual rebroadcast uses ordinary relay even with -privatebroadcast

Replacing the sendrawtransaction workaround with the new RPC or GUI action selects all-peer rather than private relay for a -privatebroadcast user.

Location: src/wallet/wallet.cpp:1843 (head).

Details and suggested fix

With -privatebroadcast=1, sendrawtransaction selects NO_MEMPOOL_PRIVATE_BROADCAST, using short-lived Tor or I2P connections. RebroadcastSingleTransaction instead always selects MEMPOOL_AND_BROADCAST_TO_ALL. This follows the option's documented exclusion of wallet submissions, but neither the new RPC help nor the GUI explains the difference from the workflow being replaced. State explicitly in both entry points that private broadcast is not used. If supporting private broadcast here instead, changing the enum alone is insufficient: SubmitTxMemoryPoolAndRelay marks every successful submission TxStateInMempool, whereas private broadcast does not add the transaction to the mempool.


Link

[suggestion] · Manual rebroadcast test misses re-admission and rejection paths

The new test only re-announces transactions already in the mempool, leaving manual recovery after eviction and RPC rejection results uncovered.

Location: test/functional/wallet_resendwallettransactions.py:53 (head).

Details and suggested fix

txid1 and txid2 come directly from sendtoaddress, with no intervening eviction, so both calls exercise the already-in-mempool branch that skips admission and fee checks. The earlier expiry loop restores transactions through mockscheduler, not this RPC. Add a case that evicts an eligible transaction, calls rebroadcastwallettx, and asserts mempool re-entry and announcement to a fresh peer. Add focused error assertions for unknown, confirmed, abandoned, block-conflicted and coinbase transactions, disabled wallet broadcasting, and a fee-cap rejection. The current combined announcement assertion also cannot distinguish one call rebroadcasting both target transactions from each call rebroadcasting only its requested transaction.


Link

[suggestion] · Rebroadcast performs blocking submission on the GUI thread

The action synchronously acquires wallet and chain locks and may run mempool admission, preventing GUI input processing while that work completes.

Location: src/qt/transactionview.cpp:407 (head).

Details and suggested fix

contextualMenu() adds a synchronous wallet eligibility call, and rebroadcastTx() directly invokes submission on the GUI thread. The latter holds cs_wallet and reaches BroadcastTransaction, which takes cs_main. For an absent transaction, it can run both test acceptance and actual admission. Lock contention or validation therefore stalls the event loop. Run at least submission on a worker, preserving the wallet's lifetime, and deliver the result back to the GUI thread for the error dialog. This follows the developer-notes guidance to offload blocking interface calls, with RPCExecutor as an example.


Link

[suggestion] · Unknown txid uses -8 instead of the -5 used by related wallet RPCs

rebroadcastwallettx reports a non-wallet txid as RPC_INVALID_PARAMETER, unlike the RPC_INVALID_ADDRESS_OR_KEY result used by gettransaction and abandontransaction.

Location: src/wallet/wallet.cpp:1836 (head).

Details and suggested fix

The missing-wallet-transaction branch returns WalletErrorCode::InvalidParameter, which the RPC mapper converts to -8. Related transaction RPCs use -5 with “Invalid or non-wallet transaction id” for the same lookup failure. Align this new API before clients depend on its error code: check wallet membership under cs_wallet in the RPC handler and return -5, as abandontransaction does. Keep the specific -8 errors for wallet transactions that exist but are ineligible. This is a consistency suggestion, not a regression for existing clients.


Link

[suggestion] · New rebroadcast RPC and GUI action lack a release note

The new user-facing RPC and context-menu action have no release note describing their availability and privacy caveat.

Location: src/wallet/rpc/transactions.cpp:1083 (head).

Details and suggested fix

rebroadcastwallettx and the “Rebroadcast transaction” action introduce a new API and a visible wallet feature. The developer notes ask for a uniquely named release-note file for such changes, but this PR adds none. Add a short note describing both entry points and warning that rebroadcasting may reveal the node's involvement as sender or receiver.


Link

[suggestion] · RPC help joins two sentences without whitespace

The description renders the sentence boundary as “transaction.Use listrawtransactions”.

Location: src/wallet/rpc/transactions.cpp:1087 (head).

Details and suggested fix

The privacy-warning literal ends with a period but no whitespace, and the following literal starts with Use. C++ concatenates them without a separator. Add \n at the end of the warning so the transaction-listing guidance starts on a separate line.


Coverage details

Earlier concerns

Earlier reports raised these, with the titles and severities shown there. This review neither republished nor resolved them.