Skip to content

net: a standing peer's inv ends the isolated broadcast - #1343

Open
Naomi-Gift wants to merge 1 commit into
reardencode:masterfrom
Naomi-Gift:net/isolated-broadcast-echo-ends-it
Open

Naomi-Gift wants to merge 1 commit into
reardencode:masterfrom
Naomi-Gift:net/isolated-broadcast-echo-ends-it

Conversation

@Naomi-Gift

Copy link
Copy Markdown
Contributor

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_echo drops it from the local-origin set, so the broadcast is done and skip_standing_inv no longer hides it
  • force_announce_txid announces it to the other standing peers
  • the peer that announced it is marked as knowing it, so it doesn't get it back

note_echo does nothing when isolated broadcast is off, so nodes without --proxy or --onion behave as before.

Test: standing_echo_ends_the_private_broadcast, a new step in peer_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.md and changelog.d/ are updated.

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.

@rearden-grok rearden-grok Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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(

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant