mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-09-11 21:20:39 +02:00
net: increase inbound capacity for block-relay-only connections
..and adjust the eviction logic. The new default max connection number is 200, the default maximum of tx-relaying inbounds is limited to 50% of all inbound connections. With 11 outbound connections, that is (200 - 11) * 0.5 = 94.5. As a result, the tx-related maximum traffic should not change drastically. When we receive an inbound connection and don't have space for another full-relay peer, we now attempt to evict specifically a full-relay inbound after receiving the version message of the new peer. Once this commit is widely deployed, the added inbound capacity will allow us to increase the number of outgoing block-relay-only connections. Co-authored-by: Amiti Uttarwar <amiti@uttarwar.org>
This commit is contained in:
@@ -35,8 +35,8 @@ MAX_MSG_DATA_LENGTH = 150
|
||||
# from net_address.h
|
||||
NETWORK_TYPE_UNROUTABLE = 0
|
||||
# Use in -maxconnections. Results in a maximum of 21 inbound connections
|
||||
MAX_CONNECTIONS = 32
|
||||
MAX_INBOUND_CONNECTIONS = MAX_CONNECTIONS - 10 - 1 # 10 outbound and 1 feeler
|
||||
MAX_CONNECTIONS = 53
|
||||
MAX_INBOUND_CONNECTIONS = 21 # 10 outbound and 1 feeler, (MAX_CONNECTIONS - 10 - 1) / 2 slots for tx-relaying inbounds
|
||||
|
||||
net_tracepoints_program = """
|
||||
#include <uapi/linux/ptrace.h>
|
||||
|
||||
@@ -45,10 +45,12 @@ class SlowP2PInterface(P2PInterface):
|
||||
class P2PEvict(BitcoinTestFramework):
|
||||
def set_test_params(self):
|
||||
self.num_nodes = 1
|
||||
# The choice of maxconnections=32 results in a maximum of 21 inbound connections
|
||||
# (32 - 10 outbound - 1 feeler). 20 inbound peers are protected from eviction:
|
||||
# The choice of maxconnections=53 results in a maximum of 21 tx-relaying inbound connections
|
||||
# (53 - 10 outbound - 1 feeler) * 0.5 = 21. The other inbound slots are reserved for block-relay-only
|
||||
# peers that don't play a role in this test.
|
||||
# 20 inbound peers are protected from eviction:
|
||||
# 4 by netgroup, 4 that sent us blocks, 4 that sent us transactions and 8 via lowest ping time
|
||||
self.extra_args = [['-maxconnections=32']]
|
||||
self.extra_args = [['-maxconnections=53']]
|
||||
|
||||
def run_test(self):
|
||||
protected_peers = set() # peers that we expect to be protected from eviction
|
||||
|
||||
@@ -76,7 +76,7 @@ class PackageRelayTest(BitcoinTestFramework):
|
||||
self.setup_clean_chain = True
|
||||
self.num_nodes = 1
|
||||
self.extra_args = [[
|
||||
"-maxmempool=5",
|
||||
"-maxmempool=5","-maxconnections=150"
|
||||
]]
|
||||
|
||||
def create_tx_below_mempoolminfee(self, wallet, utxo_to_spend=None):
|
||||
|
||||
Reference in New Issue
Block a user