Summary
Extends the private broadcast feature (#29415) to wallet transactions. When -privatebroadcast=1 is enabled, wallet RPCs (sendtoaddress, send, sendall, sendmany) now broadcast transactions through short-lived Tor/I2P connections instead of announcing to all connected peers.
Key Changes
Centralized availability check (commit 1)
- Moves the Tor/I2P reachability check from
sendrawtransactionRPC toBroadcastTransaction() - All broadcast callers now get consistent error handling
Wallet integration (commit 2)
CommitTransaction(): Uses private broadcast when enabled, fails loudly if Tor/I2P unavailableResubmitWalletTransactions(): Rebroadcasts using the original broadcast method- Persists a
private_broadcastflag in the wallet transaction’smapValue
Functional tests (commits 3-4)
- Tests wallet send via SOCKS5 proxy
- Tests flag persistence across restarts
- Tests error handling when Tor/I2P unavailable
Behavior Matrix
| Scenario | TX Flag | Node Setting | Expected Behavior | Tested |
|---|---|---|---|---|
| New tx | Private | - | Via SOCKS5, flag set | Test 1 ✓ |
| Resubmit | Private | Public | Skip | Test 2 ✓ |
| Resubmit | Public | Private | Skip | Test 3 ✓ |
| Resubmit | Private | Private | Rebroadcast | Test 3 ✓ |
| New tx | Private | - (no Tor) | RPC error | Test 4 ✓ |
| Resubmit | Private | Private (no Tor) | Log error | Test 4 ✓ |
Why skip on mode mismatch? Rebroadcasting via a different method than originally used may allow correlation of transaction to origin, or may indicate origin has -privatebroadcast enabled.