Skip to content

Commit cb31ee0

Browse files
glozowjonatack
andcommitted
[test] feefilter during and after IBD
Co-authored-by: Jon Atack <[email protected]>
1 parent 2af56d6 commit cb31ee0

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
@@ -246,6 +246,7 @@
246246
'rpc_help.py',
247247
'feature_help.py',
248248
'feature_shutdown.py',
249+
'p2p_ibd_txrelay.py',
249250
# Don't append tests at the end to avoid merge conflicts
250251
# Put them in a random line within the section that fits their approximate run-time
251252
]

0 commit comments

Comments
 (0)