aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWladimir J. van der Laan <laanwj@protonmail.com>2019-09-30 15:32:11 +0200
committerWladimir J. van der Laan <laanwj@protonmail.com>2019-09-30 15:32:18 +0200
commitc3a8e097b1afe27bce2f71817fd23cb857236d9d (patch)
treeb33967928d75ad1cc0df44764beddb0c162cd7bb
parent2fe6c185a6fea1ec827e358d93c5015d21a178fe (diff)
parent9c23ebd6b18fb1058a8d3e8aae9e0595d3a57ad5 (diff)
Merge #16991: qa: Fix service flag comparison check in rpc_net test (luke-jr)
9c23ebd6b18fb1058a8d3e8aae9e0595d3a57ad5 qa: Fix service flag comparison check in rpc_net test (Luke Dashjr) Pull request description: Rebase of #16936 ACKs for top commit: darosior: ACK 9c23ebd6b18fb1058a8d3e8aae9e0595d3a57ad5 Tree-SHA512: 74f287740403da1040ab1e235ef6eba4e304f3ee5d57a3b25d1e2e1f2f982d256528d398a4d6cb24ba393798e680a8f46cd7dae54ed84ab2c747e96288f1f884
-rwxr-xr-xtest/functional/rpc_net.py21
1 files changed, 7 insertions, 14 deletions
diff --git a/test/functional/rpc_net.py b/test/functional/rpc_net.py
index e24bf3111b..b2017bc18e 100755
--- a/test/functional/rpc_net.py
+++ b/test/functional/rpc_net.py
@@ -20,13 +20,12 @@ from test_framework.util import (
wait_until,
)
from test_framework.mininode import P2PInterface
+import test_framework.messages
from test_framework.messages import (
CAddress,
msg_addr,
NODE_NETWORK,
NODE_WITNESS,
- NODE_GETUTXO,NODE_BLOOM,
- NODE_NETWORK_LIMITED,
)
def assert_net_servicesnames(servicesflag, servicenames):
@@ -36,16 +35,10 @@ def assert_net_servicesnames(servicesflag, servicenames):
:param servicesflag: The services as an integer.
:param servicesnames: The list of decoded services names, as strings.
"""
- if servicesflag & NODE_NETWORK:
- assert "NETWORK" in servicenames
- if servicesflag & NODE_GETUTXO:
- assert "GETUTXO" in servicenames
- if servicesflag & NODE_BLOOM:
- assert "BLOOM" in servicenames
- if servicesflag & NODE_WITNESS:
- assert "WITNESS" in servicenames
- if servicesflag & NODE_NETWORK_LIMITED:
- assert "NETWORK_LIMITED" in servicenames
+ servicesflag_generated = 0
+ for servicename in servicenames:
+ servicesflag_generated |= getattr(test_framework.messages, 'NODE_' + servicename)
+ assert servicesflag_generated == servicesflag
class NetTest(BitcoinTestFramework):
def set_test_params(self):
@@ -119,7 +112,7 @@ class NetTest(BitcoinTestFramework):
# check the `servicesnames` field
network_info = [node.getnetworkinfo() for node in self.nodes]
for info in network_info:
- assert_net_servicesnames(int(info["localservices"]), info["localservicesnames"])
+ assert_net_servicesnames(int(info["localservices"], 0x10), info["localservicesnames"])
def _test_getaddednodeinfo(self):
assert_equal(self.nodes[0].getaddednodeinfo(), [])
@@ -143,7 +136,7 @@ class NetTest(BitcoinTestFramework):
assert_equal(peer_info[1][0]['minfeefilter'], Decimal("0.00001000"))
# check the `servicesnames` field
for info in peer_info:
- assert_net_servicesnames(int(info[0]["services"]), info[0]["servicesnames"])
+ assert_net_servicesnames(int(info[0]["services"], 0x10), info[0]["servicesnames"])
def _test_getnodeaddresses(self):
self.nodes[0].add_p2p_connection(P2PInterface())