aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorMarcoFalke <falke.marco@gmail.com>2020-07-17 07:51:18 +0200
committerMarcoFalke <falke.marco@gmail.com>2020-07-17 07:51:24 +0200
commit19aaf7945e89e0abe2917507b764a33ac688f71c (patch)
treecedbdf943f5d0526f74b001366c02c0bda328d0a /test
parentc57dc566b06034ce7bdb29da0db4d65e0accb382 (diff)
parentcb31ee01b42af58c64b5d3c0eabae4bcd7fd67cf (diff)
downloadbitcoin-19aaf7945e89e0abe2917507b764a33ac688f71c.tar.xz
Merge #19423: test: add functional test for txrelay during and after IBD
cb31ee01b42af58c64b5d3c0eabae4bcd7fd67cf [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](https://github.com/bitcoin/bitcoin/pull/19204#issuecomment-644040070) a functional test. ACKs for top commit: jnewbery: utACK cb31ee01b42af58c64b5d3c0eabae4bcd7fd67cf Tree-SHA512: a9effc8193fa95fb42a2f9c66b258cc7b0941fc04c1ce3a6092f4426c9bfc7e72f702aca559b3e30e90652497f411f22fae3cf5cdb6cfd6ef6d37fed712cda67
Diffstat (limited to 'test')
-rwxr-xr-xtest/functional/p2p_ibd_txrelay.py44
-rwxr-xr-xtest/functional/test_runner.py1
2 files changed, 45 insertions, 0 deletions
diff --git a/test/functional/p2p_ibd_txrelay.py b/test/functional/p2p_ibd_txrelay.py
new file mode 100755
index 0000000000..be201e6bc3
--- /dev/null
+++ b/test/functional/p2p_ibd_txrelay.py
@@ -0,0 +1,44 @@
+#!/usr/bin/env python3
+# Copyright (c) 2020 The Bitcoin Core developers
+# Distributed under the MIT software license, see the accompanying
+# file COPYING or http://www.opensource.org/licenses/mit-license.php.
+"""Test fee filters during and after IBD."""
+
+from decimal import Decimal
+
+from test_framework.messages import COIN
+from test_framework.test_framework import BitcoinTestFramework
+from test_framework.util import assert_equal
+
+MAX_FEE_FILTER = Decimal(9170997) / COIN
+NORMAL_FEE_FILTER = Decimal(100) / COIN
+
+
+class P2PIBDTxRelayTest(BitcoinTestFramework):
+ def set_test_params(self):
+ self.setup_clean_chain = True
+ self.num_nodes = 2
+ self.extra_args = [
+ ["-minrelaytxfee={}".format(NORMAL_FEE_FILTER)],
+ ["-minrelaytxfee={}".format(NORMAL_FEE_FILTER)],
+ ]
+ def run_test(self):
+ self.log.info("Check that nodes set minfilter to MAX_MONEY while still in IBD")
+ for node in self.nodes:
+ assert node.getblockchaininfo()['initialblockdownload']
+ for conn_info in node.getpeerinfo():
+ assert_equal(conn_info['minfeefilter'], MAX_FEE_FILTER)
+
+ # Come out of IBD by generating a block
+ self.nodes[0].generate(1)
+ self.sync_all()
+
+ self.log.info("Check that nodes reset minfilter after coming out of IBD")
+ for node in self.nodes:
+ assert not node.getblockchaininfo()['initialblockdownload']
+ for conn_info in node.getpeerinfo():
+ assert_equal(conn_info['minfeefilter'], NORMAL_FEE_FILTER)
+
+
+if __name__ == '__main__':
+ P2PIBDTxRelayTest().main()
diff --git a/test/functional/test_runner.py b/test/functional/test_runner.py
index 867a9909a8..2a360bd38a 100755
--- a/test/functional/test_runner.py
+++ b/test/functional/test_runner.py
@@ -248,6 +248,7 @@ BASE_SCRIPTS = [
'rpc_help.py',
'feature_help.py',
'feature_shutdown.py',
+ 'p2p_ibd_txrelay.py',
# Don't append tests at the end to avoid merge conflicts
# Put them in a random line within the section that fits their approximate run-time
]