Merge bitcoin/bitcoin#35680: private broadcast: bound rebroadcast attempts to 1,000

fe7d475d45 private broadcast: bound broadcast attempts per tx to 1k (Gregory Sanders)

Pull request description:

  Since rebroacasts introduce additional state, bound the state growth by capping the number of rebroadcasts. With ~72 bytes per record, 10k transactions rebroadcasting for ~42 hours will result about 703 MiB allocated with overhead.

ACKs for top commit:
  andrewtoth:
    ACK fe7d475d45
  frankomosh:
    ReACK fe7d475d45
  sedited:
    ACK fe7d475d45

Tree-SHA512: e4ec5156b90ad24d68b561df03ad09bdf0ac7535886ff56891cb698cf64ff0e1e484075b76040bba6194baf874c9237028c82debf7405136447ba5b5faee589c
This commit is contained in:
merge-script
2026-08-18 14:57:12 +02:00
7 changed files with 193 additions and 34 deletions

View File

@@ -46,6 +46,7 @@ from test_framework.wallet import (
P2P_PRIVATE_VERSION = 70016
NUM_PRIVATE_BROADCAST_PER_TX = 3
MAX_PRIVATE_BROADCAST_ATTEMPTS = 1000
class NoRelayP2PInterface(P2PInterface):
@@ -225,7 +226,8 @@ class P2PPrivateBroadcast(BitcoinTestFramework):
assert_equal(len(pending), 1)
assert_equal(pending[0]["hex"].lower(), tx["hex"].lower())
peers = pending[0]["peers"]
assert len(peers) >= NUM_PRIVATE_BROADCAST_PER_TX
assert_greater_than_or_equal(len(peers), NUM_PRIVATE_BROADCAST_PER_TX)
assert_equal(pending[0]["attempts_remaining"], MAX_PRIVATE_BROADCAST_ATTEMPTS - len(peers))
assert all("address" in p and "sent" in p for p in peers)
assert_greater_than_or_equal(sum(1 for p in peers if "received" in p), broadcasts_to_expect)