Review report

core: PR #36607

2 minor findings · 3 suggestions

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

Findings

Link

[minor] · A local resubmission can stop retries without announcing the transaction

If earlier private sends did not propagate the transaction, a later submitpackage can suppress its public announcement and end private retries while still reporting success.

Location: src/net_processing.cpp:2491 (head).

Details and suggested fix

submitpackage adds the transaction to the mempool, then calls BroadcastTransaction, which reaches InitiateTxBroadcastToAll(..., REQUESTED). The guard suppresses the INV and removes the transaction from the unbroadcast set, but submitpackage still returns success. On the next ReattemptPrivateBroadcast run, test_accept fails with txn-already-in-mempool. Because that result is not VALID, the code calls MarkResolved, after which GetStale() and TryGrantRetry() skip the entry. If the earlier private sends never propagated the transaction (received_by_us is unset), neither the public path nor private retries send it again. Before this change, the local mempool presence that triggered resolution also came with a public announcement. A user can recover by noticing the problem and calling sendrawtransaction again, which provides three more sends once the entry is finished. In ReattemptPrivateBroadcast, avoid calling MarkResolved when the failure is that the same wtxid is already in the local mempool and the entry has no echo, so bounded private retries can continue.


Link

[minor] · The guard does not suppress announcements of same-txid witness variants

A requested announcement of a valid alternate witness for a privately broadcast transaction is not suppressed, and the shared txid links it to the private transaction; no in-tree producer of such a variant was identified.

Location: src/private_broadcast.cpp:89 (head).

Details and suggested fix

Contains() compares only GetWitnessHash(). If private variant A is queued and a valid variant B with the same txid but a different witness reaches InitiateTxBroadcastToAll(REQUESTED), the guard does not match B, so B is announced to all peers. This can happen when B is submitted locally through submitpackage, the wallet, or the GUI while A is not in the local mempool. It can also happen when resubmitting A finds B already in the mempool and BroadcastTransaction substitutes B's wtxid. The public announcement exposes the shared txid, including to peers that receive an INV by txid rather than wtxid, linking the announcement to the private transaction. p2p_private_broadcast.py already privately broadcasts such siblings. Also match by txid, for example with a Contains(const Txid&) overload called with the mempool transaction's GetHash(), while retaining the RELAY exemption. Triggering this requires a caller-supplied alternate witness, such as a re-signed or differently signed multisig spend. No in-tree caller that produces one on its own was identified, so production impact is unconfirmed.


Optional improvements

Link

[suggestion] · Eviction removes the guard for transactions that have not propagated

After a finished entry is evicted, a later wallet resend or submitpackage announces the transaction publicly; whether 10,000 entries cover the resend interval depends on unbounded private-broadcast volume.

Location: src/private_broadcast.cpp:41 (head).

Details and suggested fix

When the queue reaches MAX_TRANSACTIONS, Add() erases the oldest finished entry. An echoed transaction becomes finished once its planned sends are picked and those peers disconnect, typically minutes after broadcast. The wallet's periodic resend runs 12–36 hours later. Because Contains() searches only m_transactions, eviction lets InitiateTxBroadcastToAll(..., REQUESTED) announce the transaction to all peers. The PR description lists restart and abortprivatebroadcast as ways the protection ends, but not eviction. Is a window of 10,000 finished entries intended to cover expected private-broadcast volume over that interval? If not, keep a compact marker, such as a bounded set of txids, that survives eviction. Otherwise, document eviction as another way the guard ends. Nothing in the checkout bounds private-broadcast volume over the resend interval, so production likelihood is unconfirmed.


Link

[suggestion] · Peers can still request suppressed transactions from the mempool

The guard stops the INV but leaves the transaction available to FindTxForGetData, so orphan resolution or a probing peer can still fetch it from this node.

Location: src/net_processing.cpp:2494 (head).

Details and suggested fix

By the time the guard runs, submitpackage or BroadcastTransaction has already added the privately broadcast transaction to the local mempool. FindTxForGetData serves mempool transactions whose entry sequence is below the peer's m_last_inv_sequence; it does not check private-broadcast storage. For example, submitpackage([private_parent, child]) announces the child normally. A peer missing the parent treats the child as an orphan, requests the parent, and receives it over a clearnet connection. A peer that already knows the identifier, such as a private-broadcast recipient that withheld the transaction, can probe for it the same way. This reveals the origin only while the transaction has not propagated elsewhere. The base announced it publicly in these flows, so this is a remaining gap rather than a regression; the new test submits only a single-transaction package. If this behavior is in scope, have FindTxForGetData skip private-broadcast entries without received_by_us. That would also block orphan resolution for such parents. Otherwise, document the limitation.


Link

[suggestion] · The fuzz model does not verify which finished entry is evicted

An implementation that evicts the newest or an arbitrary finished entry would still pass, although the header and release note promise oldest-first eviction.

Location: src/test/fuzz/private_broadcast.cpp:140 (head).

Details and suggested fix

The fuzz eviction branch finds the entry missing from GetBroadcastInfo() and only asserts IsFinished(*evicted_it). It does not model time_added. rejection_at_cap covers only the QueueFull path, where no entry is finished. Add a small unit test that constructs PrivateBroadcast with a reduced max_transactions and fills it at distinct mock times, including an older unfinished entry and at least two finished entries. Then add one more transaction and check that only the oldest finished entry was removed. Alternatively, record insertion and reset times in the fuzz model and assert that the evicted entry has the minimum time among finished entries, allowing ties.


Coverage details

Earlier concerns

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