aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorMarcoFalke <falke.marco@gmail.com>2020-06-07 10:00:41 -0400
committerMarcoFalke <falke.marco@gmail.com>2020-06-21 12:17:55 -0400
commitfaabd1514fecd828451387b025c1cc74a37bc854 (patch)
treeb503a98fa4c5e3c2b6364052936de8c12b7d1e55 /test
parentfad676b8d2dfc3a8a62db3d3395d36d3e3076a5b (diff)
test: Check that peers with forcerelay permission do not get a feefilter message
Diffstat (limited to 'test')
-rwxr-xr-xtest/functional/p2p_feefilter.py28
1 files changed, 28 insertions, 0 deletions
diff --git a/test/functional/p2p_feefilter.py b/test/functional/p2p_feefilter.py
index 0dfbb69468..f939ea965c 100755
--- a/test/functional/p2p_feefilter.py
+++ b/test/functional/p2p_feefilter.py
@@ -10,6 +10,7 @@ import time
from test_framework.messages import MSG_TX, msg_feefilter
from test_framework.mininode import mininode_lock, P2PInterface
from test_framework.test_framework import BitcoinTestFramework
+from test_framework.util import assert_equal
def hashToHex(hash):
@@ -26,6 +27,17 @@ def allInvsMatch(invsExpected, testnode):
return False
+class FeefilterConn(P2PInterface):
+ feefilter_received = False
+
+ def on_feefilter(self, message):
+ self.feefilter_received = True
+
+ def assert_feefilter_received(self, recv: bool):
+ with mininode_lock:
+ assert_equal(self.feefilter_received, recv)
+
+
class TestP2PConn(P2PInterface):
def __init__(self):
super().__init__()
@@ -55,6 +67,22 @@ class FeeFilterTest(BitcoinTestFramework):
self.skip_if_no_wallet()
def run_test(self):
+ self.test_feefilter_forcerelay()
+ self.test_feefilter()
+
+ def test_feefilter_forcerelay(self):
+ self.log.info('Check that peers without forcerelay permission (default) get a feefilter message')
+ self.nodes[0].add_p2p_connection(FeefilterConn()).assert_feefilter_received(True)
+
+ self.log.info('Check that peers with forcerelay permission do not get a feefilter message')
+ self.restart_node(0, extra_args=['-whitelist=forcerelay@127.0.0.1'])
+ self.nodes[0].add_p2p_connection(FeefilterConn()).assert_feefilter_received(False)
+
+ # Restart to disconnect peers and load default extra_args
+ self.restart_node(0)
+ self.connect_nodes(1, 0)
+
+ def test_feefilter(self):
node1 = self.nodes[1]
node0 = self.nodes[0]