2 minor findings · 3 suggestions
Earlier concerns neither republished nor resolved: 1 minor finding · 1 suggestion. See the Run archive for their assessments.
Findings
[minor] · Resolved transactions overstate remaining send attempts
After an early echo, getprivatebroadcastinfo can report 999 remaining attempts even though only the initially planned sends can still occur.
Location: src/private_broadcast.cpp:195 (head).
Details and suggested fix
A transaction can be resolved while some initially planned sends are still unpicked, for example when a peer echoes it before the other planned connections complete their handshakes. Because IsPending() deliberately ignores resolved, this branch reports m_max_send_attempts - send_statuses.size(), which is 999 by default after one send is picked. TryGrantRetry() and GetStale() skip resolved entries, so only the remaining planned sends can occur; after they are picked, the reported value drops to 0. Report std::min(state.planned_sends, m_max_send_attempts) - state.send_statuses.size() for resolved entries, while retaining the current formula for unresolved entries. Add an attempts_remaining check after the early MarkResolved() in complete_all_initial_sends, and update the fuzz oracle to use the corrected formula.
[minor] · Re-adding an exhausted transaction can silently schedule no sends
After all send attempts are used, re-adding an unresolved transaction while a peer remains connected returns success without scheduling connections; no in-tree automatic resubmitter was identified, so production impact is unconfirmed.
Location: src/private_broadcast.cpp:27 (head).
Details and suggested fix
The previous Add() reset an exhausted entry even while a recipient connection remained open. The new reset requires IsFinished(), which also requires every recipient to disconnect. If an exhausted, unresolved transaction is re-added while its last connection remains open, potentially for up to PRIVATE_BROADCAST_MAX_CONNECTION_LIFETIME (3 minutes), Add() returns AlreadyPresent. InitiateTxBroadcastPrivate() maps that result to TransactionError::OK without requesting connections, so the explicit request is dropped. The MAX_SEND_ATTEMPTS comment still promises a resend on explicit re-add. Also, getprivatebroadcastinfo reports attempts_remaining: 0 as soon as the last send is picked, while its peer may still be connected; re-adding at that point can hit this no-op. The stricter check avoids clearing send_statuses under a live peer, which previously caused that peer's GETDATA to be rejected. Return a distinct AddResult for this case and have InitiateTxBroadcastPrivate() log or return it so the caller knows no send was scheduled.
Optional improvements
[suggestion] · Eviction tests do not verify oldest-first ordering
Evicting the newest finished entry, or an arbitrary finished entry, would still satisfy the current unit and fuzz checks.
Location: src/test/fuzz/private_broadcast.cpp:140 (head).
Details and suggested fix
At capacity, Add() evicts the finished entry with the earliest time_added, as the release note promises. The fuzz target compares GetBroadcastInfo() with its model and checks only that the victim is finished; it does not track addition times. rejection_at_cap fills the queue with unsent entries, so it covers only QueueFull. Add a small-capacity unit test using FakeNodeClock: create two finished entries at different times and one unfinished entry, then add a new transaction. Check that only the older finished entry was evicted and that the newer finished entry and unfinished entry remain.
[suggestion] · Receive-metadata tests do not check which peer and time are retained
The functional test checks only that received_by_us fields exist, so incorrect or overwritten metadata and stale metadata after reset would go undetected.
Location: test/functional/p2p_private_broadcast.py:323 (head).
Details and suggested fix
The functional test checks only that received_by_us.address and .time are present. No unit or fuzz call to MarkResolved() supplies received_from. Add a unit test using FakeNodeClock and known CService values. Call MarkResolved(tx, addr1) and check the address and time returned by GetBroadcastInfo(). Advance the clock, call it again with addr2 and once without an address, and verify the metadata is unchanged. Then finish and re-add the transaction, and check that received_by_us is empty.
[suggestion] · Documentation omits eviction of exhausted, never-echoed transactions
Comments, the release note, and a test docstring do not reflect that exhausted transactions can be evicted along with echoed transactions.
Location: src/private_broadcast.h:47 (head).
Details and suggested fix
IsFinished() treats an unresolved entry that has used all its send attempts as finished once its connections close. At the cap, Add() can evict it according to time_added, alongside echoed entries. The previous Add() did not remove such entries; a full queue returned QueueFull. The MAX_SEND_ATTEMPTS comment still says an exhausted transaction remains tracked unless explicitly re-added, the release note describes eviction only for echoed transactions, and the p2p_private_broadcast_cap.py docstring says submissions are rejected rather than evicting existing entries. The fuzz comment also calls the victim “resolved.” Update these descriptions to say that finished entries, including exhausted entries, may be evicted. If failed broadcasts should be retained longer than successful echoes, evict resolved entries first instead.
Earlier concerns
Earlier reports raised these, with the titles and severities shown there. This review neither republished nor resolved them.
- [suggestion]: Remove the unused structured-binding element
- [minor]:
received_by_us.timerecords processing time, not receipt time