Motivation: Reduce the risk of accidental privacy leak happening when broadcasting non-privately a requested transaction that had been previously broadcast privately.
Background: During the initial phase of private broadcast implementation there were unforeseen instances when a private transaction could get broadcast non-privately (e.g. see #36277 #36330 #36309).
Currently known pathways:
- Re-submission through
submitpackage - Wallet-rebroadcast (when a private transaction is "picked up" by the wallet, and rebrodcast after 1-2 days)
Note that these are being addressed, but other, currently non-identified pathways cannot be excluded.
Change summary: Add a general, extra safeguard: whenever there is a transaction broadcast request, check if the given transaction has been previously broadcast privately, and if so, refuse to broadcast non-privately.
Transaction relay is not affected, as it should not be affected by private broadcast. When we receive a previously private-broadcast transaction for the first time (it's not yet in our mempool), we relay it as any other relayed transaction. Behavior is unchanged in this regard.
Notes:
- Prerequisite: This is built on top of #36477, as keeping finished private broadcasts in the queue is a prerequisite for this change to work.
- This proposed change is not an alternative to the use-case specific safeguards, but a complementary one.
- Testing currently uses the two pathways listed above. When they are closed, testing will be more difficult (i.e., it is hard to establish whether non-private broadcast is prevented by the use-case specific or the present generic guard).
- The private broadcast queue is not persisted, it doesn't survive node restarts
- Entries deleted via
abortprivatebroadcastwill be forgotten.