3 minor findings · 8 suggestions
Findings
[minor] · Rebroadcast slot indexes a selection that can be empty
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() validates the selection before opening the non-blocking popup, but rebroadcastTx() reads the selection again when triggered. A pending 200 ms search or amount filter can hide the selected row while the menu remains open. The enabled action then calls selection.at(0) on an empty list, causing an assertion in a debug Qt build or undefined behavior in a release build. Return early for an empty fresh selection and check Txid::FromHex before dereferencing it, as contextualMenu() does. Older abandon and bump handlers share this pattern, but this PR adds another affected handler. No production occurrence was identified.
[minor] · Some rebroadcast failures return an empty error message
Fee-cap rejection or an unprocessed confirmation can produce RPC_MISC_ERROR with an empty message, or an empty "Rebroadcast Failed" dialog.
Location: src/wallet/wallet.cpp:1844 (head).
Details and suggested fix
RebroadcastSingleTransaction initializes an empty err, but the chain adapter reduces BroadcastTransaction's typed result to a bool. For an otherwise acceptable transaction absent from the mempool, the fee-cap checks can reject it without filling that string. A confirmation not yet processed by the wallet can also return ALREADY_IN_UTXO_SET without details when an output remains unspent. The new RPC and GUI expose the empty string directly. Fill empty error details from TransactionErrorString(err) in the chain adapter. Incoming payments or transactions created before lowering the wallet's caps can reach the fee path. No production occurrence was identified; the default limits of 0.1 BTC and 0.1 BTC/kvB make that case uncommon unless the caps are lowered.
[minor] · rebroadcastwallettx checks eligibility before syncing wallet notifications
Queued block notifications can make the RPC reject an eligible transaction as confirmed or report a confusing failure for a newly confirmed transaction.
Location: src/wallet/rpc/transactions.cpp:1103 (head).
Details and suggested fix
TransactionCanBeBroadcast reads the transaction's cached wallet state and last processed height. If a block disconnection is still queued, it can reject a now-unconfirmed transaction as "tx is confirmed". Conversely, a queued connection can let a newly confirmed transaction pass eligibility and then fail with an empty message when an output remains in the UTXO set. These failures resolve once notifications drain. Call wallet->BlockUntilSyncedToCurrentChain() before RebroadcastSingleTransaction, without holding cs_wallet, as gettransaction and abandontransaction do. This makes eligibility consistent with chainstate known before RPC entry, without claiming to prevent later concurrent chain changes.
Optional improvements
[suggestion] · Manual rebroadcast bypasses the periodic sync-readiness guard
During reindex, import or IBD, manual rebroadcast can announce old wallet transactions that only appear unconfirmed, unlike periodic resend.
Location: src/wallet/wallet.cpp:1838 (head).
Details and suggested fix
ShouldResend() checks chain().isReadyToBroadcast() specifically because old wallet transactions can appear unconfirmed during reindex, import and IBD. Manual eligibility and submission omit this check. If loading marks a transaction's block as inactive, its depth becomes zero and Rebroadcast can be enabled; successful mempool admission then queues ordinary peer announcements. Consider applying the readiness check to manual eligibility, returning a clear syncing error and disabling the GUI action. If an explicit request should deliberately override this policy, document that confirmation status may be stale while syncing. Relay remains conditional on admission and peer announcement filters.
[suggestion] · GUI rebroadcast omits the RPC's privacy warning
The GUI queues ordinary peer relay for sent or received transactions without showing the sender/receiver privacy warning included in RPC help.
Location: src/qt/transactionview.cpp:407 (head).
Details and suggested fix
rebroadcastTx() calls the wallet operation immediately, using MEMPOOL_AND_BROADCAST_TO_ALL, and displays a dialog only on failure. Received payments are eligible too, so the action may reveal the node's involvement as either sender or receiver, as the new RPC help already explains. Show a confirmation containing the same warning and a cancel option before submitting. Cancelling should leave broadcast state untouched.
[suggestion] · Manual rebroadcast always uses ordinary relay, even with -privatebroadcast
Users switching from sendrawtransaction with -privatebroadcast to the new RPC or GUI action change relay modes without an explicit notice in either entry point.
Location: src/wallet/wallet.cpp:1843 (head).
Details and suggested fix
With -privatebroadcast=1, sendrawtransaction uses short-lived Tor or I2P connections without inserting the transaction into the local mempool. RebroadcastSingleTransaction instead always uses MEMPOOL_AND_BROADCAST_TO_ALL. This matches the option's documented exclusion of wallet submissions, but the new RPC help and GUI should explicitly state that manual wallet rebroadcast does not use private broadcast. Do not address this by merely changing the enum: the wallet helper marks every success TxStateInMempool, and private broadcast would not provide local mempool restoration.
[suggestion] · Rebroadcast performs blocking wallet and node work on the GUI thread
The action synchronously takes wallet and chain locks and may run mempool admission, leaving the GUI event loop blocked until it finishes.
Location: src/qt/transactionview.cpp:407 (head).
Details and suggested fix
rebroadcastTx() directly calls rebroadcastTransaction, which holds cs_wallet and reaches BroadcastTransaction. That function takes cs_main and, for an absent transaction under the default fee caps, runs test acceptance followed by real admission. Opening the context menu also adds a blocking wallet eligibility call. Offload at least submission to a worker, following the developer notes' RPCExecutor example. Keep the wallet alive for the operation and deliver the result back to the GUI thread for the error dialog.
[suggestion] · Manual rebroadcast test covers only existing mempool entries
The test never removes a transaction before calling the new RPC, so it misses manual mempool restoration and every rejection path.
Location: test/functional/wallet_resendwallettransactions.py:53 (head).
Details and suggested fix
txid1 and txid2 remain in the mempool when rebroadcastwallettx runs, so both calls take the re-announcement branch that skips admission and fee checks. The earlier expiry case restores transactions through mockscheduler, not this RPC. Add an independent transaction, expire it using the existing mocktime pattern, and assert that manual rebroadcast restores its mempool entry and announces it to a fresh peer. Also add assert_raises_rpc_error cases for an unknown txid, confirmed, abandoned, block-conflicted and coinbase transactions, -walletbroadcast=0, and fee-cap rejection.
[suggestion] · Unknown txid uses a different error code from related wallet RPCs
rebroadcastwallettx returns -8 for a non-wallet txid, while gettransaction and abandontransaction return -5 for the same lookup failure.
Location: src/wallet/wallet.cpp:1836 (head).
Details and suggested fix
The not-in-wallet branch returns WalletErrorCode::InvalidParameter, which maps to RPC_INVALID_PARAMETER (-8). Related transaction RPCs instead use RPC_INVALID_ADDRESS_OR_KEY (-5) with "Invalid or non-wallet transaction id". Consider checking wallet membership in the RPC handler and returning -5, as abandontransaction does, before clients depend on this difference. Keep -8 for wallet transactions that exist but are ineligible.
[suggestion] · Rebroadcast duplicates Abandon's menu mnemonic
In the English menu, Abandon and Rebroadcast both use 'b', so that key no longer directly selects one enabled action.
Location: src/qt/transactionview.cpp:172 (head).
Details and suggested fix
A&bandon transaction and Re&broadcast transaction both assign 'b'. Both actions can be enabled for an unconfirmed transaction absent from the mempool. Qt cycles between entries with duplicate mnemonics instead of directly activating one, which is particularly confusing for these opposing operations. Use an unused letter, such as Rebroadcas&t transaction. 'r' and 'd' already belong to the raw-transaction and full-details copy actions.
[suggestion] · The new RPC and GUI action have no release note
The user-visible manual rebroadcast feature is not described in a release note.
Location: src/wallet/rpc/transactions.cpp:1083 (head).
Details and suggested fix
This PR adds the public rebroadcastwallettx RPC and a "Rebroadcast transaction" menu action, but adds no release note. The developer notes request a uniquely named doc/release-notes-*.md for new features and API or visible user changes. Add a short note describing both entry points and warning that rebroadcasting may reveal the node's involvement as sender or receiver.