Skip to content

Commit dbfe294

Browse files
committed
[tests] define NODE_NETWORK_LIMITED in test framework
1 parent 1285312 commit dbfe294

File tree

2 files changed

+6
-9
lines changed

2 files changed

+6
-9
lines changed

test/functional/node_network_limited.py

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
# Distributed under the MIT software license, see the accompanying
44
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
55
from test_framework.messages import CInv, msg_getdata, msg_verack
6-
from test_framework.mininode import NetworkThread, P2PInterface
6+
from test_framework.mininode import NODE_BLOOM, NODE_NETWORK_LIMITED, NODE_WITNESS, NetworkThread, P2PInterface
77
from test_framework.test_framework import BitcoinTestFramework
88
from test_framework.util import assert_equal
99

@@ -47,11 +47,7 @@ def try_get_block_via_getdata(self, blockhash, must_disconnect):
4747

4848
def run_test(self):
4949
# NODE_BLOOM & NODE_WITNESS & NODE_NETWORK_LIMITED must now be signaled
50-
assert_equal(self.get_signalled_service_flags(), 1036) # 1036 == 0x40C == 0100 0000 1100
51-
# | ||
52-
# | |^--- NODE_BLOOM
53-
# | ^---- NODE_WITNESS
54-
# ^-- NODE_NETWORK_LIMITED
50+
assert_equal(self.get_signalled_service_flags(), NODE_BLOOM | NODE_WITNESS | NODE_NETWORK_LIMITED)
5551

5652
# Now mine some blocks over the NODE_NETWORK_LIMITED + 2(racy buffer ext.) target
5753
firstblock = self.nodes[0].generate(1)[0]
@@ -66,10 +62,10 @@ def run_test(self):
6662

6763
# NODE_NETWORK_LIMITED must still be signaled after restart
6864
self.restart_node(0)
69-
assert_equal(self.get_signalled_service_flags(), 1036)
65+
assert_equal(self.get_signalled_service_flags(), NODE_BLOOM | NODE_WITNESS | NODE_NETWORK_LIMITED)
7066

7167
# Test the RPC service flags
72-
assert_equal(self.nodes[0].getnetworkinfo()['localservices'], "000000000000040c")
68+
assert_equal(int(self.nodes[0].getnetworkinfo()['localservices'], 16), NODE_BLOOM | NODE_WITNESS | NODE_NETWORK_LIMITED)
7369

7470
# getdata a block above the NODE_NETWORK_LIMITED threshold must be possible
7571
self.try_get_block_via_getdata(block_within_limited_range, False)

test/functional/test_framework/messages.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,10 +38,11 @@
3838

3939
NODE_NETWORK = (1 << 0)
4040
# NODE_GETUTXO = (1 << 1)
41-
# NODE_BLOOM = (1 << 2)
41+
NODE_BLOOM = (1 << 2)
4242
NODE_WITNESS = (1 << 3)
4343
NODE_UNSUPPORTED_SERVICE_BIT_5 = (1 << 5)
4444
NODE_UNSUPPORTED_SERVICE_BIT_7 = (1 << 7)
45+
NODE_NETWORK_LIMITED = (1 << 10)
4546

4647
# Serialization/deserialization tools
4748
def sha256(s):

0 commit comments

Comments
 (0)