Repository navigation
net: a standing peer's inv ends the isolated broadcast - #1343
Naomi-Gift wants to merge 1 commit into
Conversation
Isolated broadcast never announced a local tx on standing peers, even after the network had it, so the node stood out as the one peer that never mentioned its own tx. Core's private broadcast counts the job done when the tx comes back from an ordinary peer, then relays it normally. When a standing peer announces a local tx (by txid or wtxid), note_echo drops it from the local-origin set, and force_announce_txid announces it to the other peers. The announcing peer is marked as knowing it. Part of item 5 of reardencode#1275.
There was a problem hiding this comment.
REQUEST_CHANGES
1 bug. A standing peer's inv ends the private broadcast and aborts the in-flight one-shot sends. See the comment on end_private_broadcast_on_echo.
docs/operator/operations.md and changelog.d/isolated-broadcast-echo-ends-it.md describe that inv as proof the network has the tx, and the following announce as like any other.
| Some(Inventory::WitnessTransaction(*txid)) | ||
| } | ||
|
|
||
| fn end_private_broadcast_on_echo( |
There was a problem hiding this comment.
end_private_broadcast_on_echo treats a standing peer's inv as the tx coming back. on_inv_txid does this for a bare txid, including from a wtxid-relay peer, and from a block-relay peer because on_inv runs this before reject_unsolicited_tx. on_inv_wtxid does it for a wtxid already in the pool. The peer never sends the transaction. Core's MarkResolved runs on the tx message and only for the same wtxid.
note_echo removes the local-origin entry. The one-shot loop uses is_local_origin as in_pool, so the remaining isolated sends abort and are logged as left the mempool. The second AddrMan target is skipped when an echo arrives between dials. The removal also happens before the session is known, so a missing session cancels those sends and does not announce. force_announce_txid then invs every other standing peer immediately; every other tx waits on take_tx_inv_due (30s). A private-broadcast recipient that also has a standing connection, or a standing peer it tells the txid, can force that announce while it is the only holder.
Drop local-origin only after a standing peer delivers this wtxid, and keep it for the in-flight sends until those dials finish. Queue the normal delayed inv. standing_echo_ends_the_private_broadcast requires the inv-only outcome, and the operations paragraph plus the changelog fragment call that announce proof the network has the tx.
Part of item 5 of #1275.
Isolated broadcast never announced a local tx on standing peers (
skip_standing_inv), even after the network had it. So the node stood out as the one peer that never mentioned its own tx. Core's private broadcast counts the job done when the tx comes back from an ordinary peer, and relays it normally after that.Now, when a standing peer announces a local tx, by txid (
on_inv_txid) or by wtxid (on_inv_wtxid):MempoolHub::note_echodrops it from the local-origin set, so the broadcast is done andskip_standing_invno longer hides itforce_announce_txidannounces it to the other standing peersnote_echodoes nothing when isolated broadcast is off, so nodes without--proxyor--onionbehave as before.Test:
standing_echo_ends_the_private_broadcast, a new step inpeer_blocksonly_and_orphan_tx. For an inv by wtxid and an inv by txid, the tx stops being local-origin, another standing peer gets an inv for it, and the announcing peer gets none. On master it fails: the tx stays local-origin.The retry when the tx doesn't come back is the other half of item 5. I'll send it as a separate PR.
docs/operator/operations.mdandchangelog.d/are updated.