diff options
author | Jim Posen <jim.posen@gmail.com> | 2020-05-04 14:29:00 -0400 |
---|---|---|
committer | John Newbery <john@johnnewbery.com> | 2020-05-31 23:01:13 -0400 |
commit | f5c003d3ead182335252558c5c6c9b9ca8968065 (patch) | |
tree | dbd8fc908443b5b2f2413ab62e270b54466d06a3 /test/functional | |
parent | 132b30d9c84f2a8053714a438f227b583a89a9ea (diff) |
[test] Add test for NODE_COMPACT_FILTER.
Test that a node configured to serve compact filters will signal
NODE_COMPACT_FILTER service bit.
Diffstat (limited to 'test/functional')
-rwxr-xr-x | test/functional/p2p_blockfilters.py | 13 | ||||
-rwxr-xr-x | test/functional/test_framework/messages.py | 1 |
2 files changed, 12 insertions, 2 deletions
diff --git a/test/functional/p2p_blockfilters.py b/test/functional/p2p_blockfilters.py index 6d26da3841..a9e86bd2fc 100755 --- a/test/functional/p2p_blockfilters.py +++ b/test/functional/p2p_blockfilters.py @@ -4,12 +4,13 @@ # file COPYING or http://www.opensource.org/licenses/mit-license.php. """Tests NODE_COMPACT_FILTERS (BIP 157/158). -Tests that a node configured with -blockfilterindex and -peerblockfilters can serve -cfilters, cfheaders and cfcheckpts. +Tests that a node configured with -blockfilterindex and -peerblockfilters signals +NODE_COMPACT_FILTERS and can serve cfilters, cfheaders and cfcheckpts. """ from test_framework.messages import ( FILTER_TYPE_BASIC, + NODE_COMPACT_FILTERS, hash256, msg_getcfcheckpt, msg_getcfheaders, @@ -70,6 +71,14 @@ class CompactFiltersTest(BitcoinTestFramework): self.nodes[1].generate(1001) wait_until(lambda: self.nodes[1].getblockcount() == 2000) + # Check that nodes have signalled NODE_COMPACT_FILTERS correctly. + assert node0.nServices & NODE_COMPACT_FILTERS != 0 + assert node1.nServices & NODE_COMPACT_FILTERS == 0 + + # Check that the localservices is as expected. + assert int(self.nodes[0].getnetworkinfo()['localservices'], 16) & NODE_COMPACT_FILTERS != 0 + assert int(self.nodes[1].getnetworkinfo()['localservices'], 16) & NODE_COMPACT_FILTERS == 0 + self.log.info("get cfcheckpt on chain to be re-orged out.") request = msg_getcfcheckpt( filter_type=FILTER_TYPE_BASIC, diff --git a/test/functional/test_framework/messages.py b/test/functional/test_framework/messages.py index 4d1dd4422e..9a6fa66d54 100755 --- a/test/functional/test_framework/messages.py +++ b/test/functional/test_framework/messages.py @@ -49,6 +49,7 @@ NODE_NETWORK = (1 << 0) NODE_GETUTXO = (1 << 1) NODE_BLOOM = (1 << 2) NODE_WITNESS = (1 << 3) +NODE_COMPACT_FILTERS = (1 << 6) NODE_NETWORK_LIMITED = (1 << 10) MSG_TX = 1 |