aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorMarcoFalke <falke.marco@gmail.com>2020-03-31 09:35:53 -0400
committerMarcoFalke <falke.marco@gmail.com>2020-03-31 09:36:02 -0400
commitd52ba21dfff99173abb927bc964ce7ceb711d789 (patch)
tree35fe6b6fc09703fee14f23fa58e8ad20d8f4722f /test
parent9a2b5f22c1f603a6e3abc16dbf074c8d33a8d01f (diff)
parent00559229588feb19de2a0cb7506f70c483a1f433 (diff)
downloadbitcoin-d52ba21dfff99173abb927bc964ce7ceb711d789.tar.xz
Merge #18481: test: add BIP37 'filterclear' test to p2p_filter.py
00559229588feb19de2a0cb7506f70c483a1f433 test: add BIP37 'filterclear' test to p2p_filter.py (Sebastian Falbesoner) Pull request description: Integrates the message type `filterclear` to the test framework and adds a simple test to `p2p_filter.py`, checking that arbitrary txs get relayed again after deleting the filter. ACKs for top commit: naumenkogs: utACK 00559229588feb19de2a0cb7506f70c483a1f433 Tree-SHA512: fe64e99a526865770707d8077b9968d3923f248045ec7fa56cd380dba85ac77a71a473d244ef3aede2fc0d287b8d7c6bc0156b6033b0c949c2058cc08e255697
Diffstat (limited to 'test')
-rwxr-xr-xtest/functional/p2p_filter.py8
-rwxr-xr-xtest/functional/test_framework/messages.py17
-rwxr-xr-xtest/functional/test_framework/mininode.py3
3 files changed, 28 insertions, 0 deletions
diff --git a/test/functional/p2p_filter.py b/test/functional/p2p_filter.py
index a22ee91483..ad7a9dcf6e 100755
--- a/test/functional/p2p_filter.py
+++ b/test/functional/p2p_filter.py
@@ -11,6 +11,7 @@ from test_framework.messages import (
MSG_FILTERED_BLOCK,
msg_getdata,
msg_filterload,
+ msg_filterclear,
)
from test_framework.mininode import (
P2PInterface,
@@ -97,6 +98,13 @@ class FilterTest(BitcoinTestFramework):
filter_node.wait_for_tx(txid)
assert not filter_node.merkleblock_received
+ self.log.info('Check that after deleting filter all txs get relayed again')
+ filter_node.send_message(msg_filterclear())
+ filter_node.sync_with_ping()
+ for _ in range(5):
+ txid = self.nodes[0].sendtoaddress(self.nodes[0].getnewaddress(), 7)
+ filter_node.wait_for_tx(txid)
+
if __name__ == '__main__':
FilterTest().main()
diff --git a/test/functional/test_framework/messages.py b/test/functional/test_framework/messages.py
index 9e87ad62a1..ff0c763b72 100755
--- a/test/functional/test_framework/messages.py
+++ b/test/functional/test_framework/messages.py
@@ -1356,6 +1356,23 @@ class msg_filterload:
self.data, self.nHashFuncs, self.nTweak, self.nFlags)
+class msg_filterclear:
+ __slots__ = ()
+ command = b"filterclear"
+
+ def __init__(self):
+ pass
+
+ def deserialize(self, f):
+ pass
+
+ def serialize(self):
+ return b""
+
+ def __repr__(self):
+ return "msg_filterclear()"
+
+
class msg_feefilter:
__slots__ = ("feerate",)
command = b"feefilter"
diff --git a/test/functional/test_framework/mininode.py b/test/functional/test_framework/mininode.py
index b760e7e1f3..ce51513ce9 100755
--- a/test/functional/test_framework/mininode.py
+++ b/test/functional/test_framework/mininode.py
@@ -30,6 +30,7 @@ from test_framework.messages import (
msg_blocktxn,
msg_cmpctblock,
msg_feefilter,
+ msg_filterclear,
msg_filterload,
msg_getaddr,
msg_getblocks,
@@ -64,6 +65,7 @@ MESSAGEMAP = {
b"blocktxn": msg_blocktxn,
b"cmpctblock": msg_cmpctblock,
b"feefilter": msg_feefilter,
+ b"filterclear": msg_filterclear,
b"filterload": msg_filterload,
b"getaddr": msg_getaddr,
b"getblocks": msg_getblocks,
@@ -322,6 +324,7 @@ class P2PInterface(P2PConnection):
def on_blocktxn(self, message): pass
def on_cmpctblock(self, message): pass
def on_feefilter(self, message): pass
+ def on_filterclear(self, message): pass
def on_filterload(self, message): pass
def on_getaddr(self, message): pass
def on_getblocks(self, message): pass