aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorJohn Newbery <john@johnnewbery.com>2017-12-11 11:56:24 -0500
committerJohn Newbery <john@johnnewbery.com>2017-12-19 11:19:55 -0500
commitdbfe294805a094ba4ed6178a56d0a7588fcd8c27 (patch)
tree23de54a5ac77f2c470e1b58e93e107a848b3a0dd /test
parent12853120484e19bbd9cf90574d5eaa9cb46255a5 (diff)
downloadbitcoin-dbfe294805a094ba4ed6178a56d0a7588fcd8c27.tar.xz
[tests] define NODE_NETWORK_LIMITED in test framework
Diffstat (limited to 'test')
-rwxr-xr-xtest/functional/node_network_limited.py12
-rw-r--r--test/functional/test_framework/messages.py3
2 files changed, 6 insertions, 9 deletions
diff --git a/test/functional/node_network_limited.py b/test/functional/node_network_limited.py
index 5229dfc99b..1e7c61b44c 100755
--- a/test/functional/node_network_limited.py
+++ b/test/functional/node_network_limited.py
@@ -3,7 +3,7 @@
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
from test_framework.messages import CInv, msg_getdata, msg_verack
-from test_framework.mininode import NetworkThread, P2PInterface
+from test_framework.mininode import NODE_BLOOM, NODE_NETWORK_LIMITED, NODE_WITNESS, NetworkThread, P2PInterface
from test_framework.test_framework import BitcoinTestFramework
from test_framework.util import assert_equal
@@ -47,11 +47,7 @@ class NodeNetworkLimitedTest(BitcoinTestFramework):
def run_test(self):
# NODE_BLOOM & NODE_WITNESS & NODE_NETWORK_LIMITED must now be signaled
- assert_equal(self.get_signalled_service_flags(), 1036) # 1036 == 0x40C == 0100 0000 1100
-# | ||
-# | |^--- NODE_BLOOM
-# | ^---- NODE_WITNESS
-# ^-- NODE_NETWORK_LIMITED
+ assert_equal(self.get_signalled_service_flags(), NODE_BLOOM | NODE_WITNESS | NODE_NETWORK_LIMITED)
# Now mine some blocks over the NODE_NETWORK_LIMITED + 2(racy buffer ext.) target
firstblock = self.nodes[0].generate(1)[0]
@@ -66,10 +62,10 @@ class NodeNetworkLimitedTest(BitcoinTestFramework):
# NODE_NETWORK_LIMITED must still be signaled after restart
self.restart_node(0)
- assert_equal(self.get_signalled_service_flags(), 1036)
+ assert_equal(self.get_signalled_service_flags(), NODE_BLOOM | NODE_WITNESS | NODE_NETWORK_LIMITED)
# Test the RPC service flags
- assert_equal(self.nodes[0].getnetworkinfo()['localservices'], "000000000000040c")
+ assert_equal(int(self.nodes[0].getnetworkinfo()['localservices'], 16), NODE_BLOOM | NODE_WITNESS | NODE_NETWORK_LIMITED)
# getdata a block above the NODE_NETWORK_LIMITED threshold must be possible
self.try_get_block_via_getdata(block_within_limited_range, False)
diff --git a/test/functional/test_framework/messages.py b/test/functional/test_framework/messages.py
index 2ab1bdac0f..d8032e4430 100644
--- a/test/functional/test_framework/messages.py
+++ b/test/functional/test_framework/messages.py
@@ -38,10 +38,11 @@ COIN = 100000000 # 1 btc in satoshis
NODE_NETWORK = (1 << 0)
# NODE_GETUTXO = (1 << 1)
-# NODE_BLOOM = (1 << 2)
+NODE_BLOOM = (1 << 2)
NODE_WITNESS = (1 << 3)
NODE_UNSUPPORTED_SERVICE_BIT_5 = (1 << 5)
NODE_UNSUPPORTED_SERVICE_BIT_7 = (1 << 7)
+NODE_NETWORK_LIMITED = (1 << 10)
# Serialization/deserialization tools
def sha256(s):