init: make inbound tx relay percentage configurable

Permit users to change the amount of inbounds that are permitted to relay
transactions. This is particularly relevant to ensure that superusers that are
not concerned with resource usage are not artificially restricted from offering
many transaction relay slots to the network.

Co-authored-by: Martin Zumsande <mzumsande@gmail.com>
This commit is contained in:
Amiti Uttarwar
2023-09-08 16:37:08 -07:00
committed by Martin Zumsande
parent cc59aee196
commit 0bd3d3dfa5
4 changed files with 19 additions and 6 deletions

View File

@@ -58,6 +58,16 @@ class P2PConnectionLimits(BitcoinTestFramework):
self.nodes[0].add_p2p_connection(P2PInterface(), send_version=False, wait_for_verack=False, expect_success=False)
self.wait_until(lambda: len(node.getpeerinfo()) == 2)
self.log.info('Test different values of inboundrelaypercent')
self.restart_node(0, ['-maxconnections=13', '-inboundrelaypercent=0'])
with node.assert_debug_log(['failed to find a tx-relaying eviction candidate - connection dropped'], timeout=2):
self.nodes[0].add_p2p_connection(P2PInterface(), expect_success=False, wait_for_verack=False)
self.restart_node(0, ['-maxconnections=13', '-inboundrelaypercent=100'])
node.add_p2p_connection(P2PInterface())
node.add_p2p_connection(P2PInterface())
self.wait_until(lambda: len(node.getpeerinfo()) == 2)
if __name__ == '__main__':
P2PConnectionLimits(__file__).main()

View File

@@ -76,7 +76,7 @@ class PackageRelayTest(BitcoinTestFramework):
self.setup_clean_chain = True
self.num_nodes = 1
self.extra_args = [[
"-maxmempool=5","-maxconnections=150"
"-maxmempool=5","-inboundrelaypercent=100"
]]
def create_tx_below_mempoolminfee(self, wallet, utxo_to_spend=None):