Skip to content

Commit 19aaf79

Browse files
author
MarcoFalke
committed
Merge #19423: test: add functional test for txrelay during and after IBD
cb31ee0 [test] feefilter during and after IBD (gzhao408) Pull request description: This is a followup to #19204 which uses `minfeefilter=MAX_MONEY` to effectively shut off txrelay, thereby reducing inv traffic, when nodes are in IBD. It was [missing](bitcoin/bitcoin#19204 (comment)) a functional test. ACKs for top commit: jnewbery: utACK cb31ee0 Tree-SHA512: a9effc8193fa95fb42a2f9c66b258cc7b0941fc04c1ce3a6092f4426c9bfc7e72f702aca559b3e30e90652497f411f22fae3cf5cdb6cfd6ef6d37fed712cda67
2 parents c57dc56 + cb31ee0 commit 19aaf79

File tree

2 files changed

+45
-0
lines changed

2 files changed

+45
-0
lines changed

test/functional/p2p_ibd_txrelay.py

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
#!/usr/bin/env python3
2+
# Copyright (c) 2020 The Bitcoin Core developers
3+
# Distributed under the MIT software license, see the accompanying
4+
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
5+
"""Test fee filters during and after IBD."""
6+
7+
from decimal import Decimal
8+
9+
from test_framework.messages import COIN
10+
from test_framework.test_framework import BitcoinTestFramework
11+
from test_framework.util import assert_equal
12+
13+
MAX_FEE_FILTER = Decimal(9170997) / COIN
14+
NORMAL_FEE_FILTER = Decimal(100) / COIN
15+
16+
17+
class P2PIBDTxRelayTest(BitcoinTestFramework):
18+
def set_test_params(self):
19+
self.setup_clean_chain = True
20+
self.num_nodes = 2
21+
self.extra_args = [
22+
["-minrelaytxfee={}".format(NORMAL_FEE_FILTER)],
23+
["-minrelaytxfee={}".format(NORMAL_FEE_FILTER)],
24+
]
25+
def run_test(self):
26+
self.log.info("Check that nodes set minfilter to MAX_MONEY while still in IBD")
27+
for node in self.nodes:
28+
assert node.getblockchaininfo()['initialblockdownload']
29+
for conn_info in node.getpeerinfo():
30+
assert_equal(conn_info['minfeefilter'], MAX_FEE_FILTER)
31+
32+
# Come out of IBD by generating a block
33+
self.nodes[0].generate(1)
34+
self.sync_all()
35+
36+
self.log.info("Check that nodes reset minfilter after coming out of IBD")
37+
for node in self.nodes:
38+
assert not node.getblockchaininfo()['initialblockdownload']
39+
for conn_info in node.getpeerinfo():
40+
assert_equal(conn_info['minfeefilter'], NORMAL_FEE_FILTER)
41+
42+
43+
if __name__ == '__main__':
44+
P2PIBDTxRelayTest().main()

test/functional/test_runner.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -248,6 +248,7 @@
248248
'rpc_help.py',
249249
'feature_help.py',
250250
'feature_shutdown.py',
251+
'p2p_ibd_txrelay.py',
251252
# Don't append tests at the end to avoid merge conflicts
252253
# Put them in a random line within the section that fits their approximate run-time
253254
]

0 commit comments

Comments
 (0)