HomePhabricator

[mempool] Track "unbroadcast" transactions

Description

[mempool] Track "unbroadcast" transactions

Summary:

  • Mempool tracks locally submitted transactions (wallet or rpc)
  • Transactions are removed from set when the node receives a GETDATA request from a peer, or if the transaction is removed from the mempool.

PR description:

This PR introduces mempool tracking of unbroadcast transactions and periodic reattempts at initial broadcast. This is a part of the rebroadcast project, and a standalone privacy win.

The current rebroadcast logic is terrible for privacy because 1. only the source wallet rebroadcasts transactions and 2. it does so quite frequently. In the current system, if a user submits a transaction that does not immediately get broadcast to the network (eg. they are offline), this "rebroadcast" behavior is the safety net that can actually serve as the initial broadcast. So, keeping the attempts frequent is important for initial delivery within a reasonable timespan.

This PR aims to improve # 2 by reducing the wallet rebroadcast frequency to ~1/day from ~1/15 min. It achieves this by separating the notion of initial broadcast from rebroadcasts. With these changes, the mempool tracks locally submitted transactions & periodically reattempts initial broadcast. Transactions submitted via the wallet or RPC are added to an "unbroadcast" set & are removed when a peer sends a getdata request, or the transaction is removed from the mempool. Every 10-15 minutes, the node reattempts an initial broadcast. This enables reducing the wallet rebroadcast frequency while ensuring the transactions will be propagated to the network.

For privacy improvements around # 1, please see PR16698.

This is a backport of Core PR18038 [1/7]
https://github.com/bitcoin/bitcoin/pull/18038/commits/89eeb4a3335f8e871cc3f5286af4546dff66172a

Test Plan: ninja all check-all

Reviewers: #bitcoin_abc, majcosta

Reviewed By: #bitcoin_abc, majcosta

Subscribers: majcosta

Differential Revision: https://reviews.bitcoinabc.org/D9006

Details

Provenance
Amiti Uttarwar <amiti@uttarwar.org>Authored on Jan 21 2021, 14:37
PiRKCommitted on Jan 21 2021, 14:37
abc-botPushed on Jan 21 2021, 14:43
Reviewer
Restricted Project
Differential Revision
D9006: [mempool] Track "unbroadcast" transactions
Parents
rABCe7c737ed6f1f: tests: Add fuzzing harness for Golomb-Rice coding…
Branches
Unknown
Tags
Unknown