HomePhabricator

qa: Fix service flag comparison check in rpc_net test

Description

qa: Fix service flag comparison check in rpc_net test

Summary:
The tests added in PR16850 assumed that the field localservices returned by getnetworkinfo was a string representation of an integer, when it is really a string representation of a hex. This fixes the test to decode the field properly and do the correct bitwise comparisons.

This is a backport of Core PR16991

Test Plan:
ninja && ./test/functional/test_runner.py rpc_net.py

$ bitcoin-cli getnetworkinfo
...
 "localservices": "0000000000000425",
  "localservicesnames": [
    "NETWORK",
    "BLOOM",
    "BITCOIN_CASH",
    "NETWORK_LIMITED"
  ],
...

$ python
>>> int("425", 16)
1061
>>> NODE_NETWORK = (1 << 0)
>>> NODE_BLOOM = (1 << 2)
>>> NODE_BITCOIN_CASH = (1 << 5)
>>> NODE_NETWORK_LIMITED = (1 << 10)
>>> NODE_NETWORK | NODE_BLOOM | NODE_BITCOIN_CASH | NODE_NETWORK_LIMITED
1061
>>>

Reviewers: O1 Bitcoin ABC, #bitcoin_abc, deadalnix, Fabien

Reviewed By: O1 Bitcoin ABC, #bitcoin_abc, deadalnix, Fabien

Differential Revision: https://reviews.bitcoinabc.org/D8083

Details

Provenance
Luke Dashjr <luke-jr+git@utopios.org>Authored on Sep 22 2019, 04:20
PiRKCommitted on Oct 23 2020, 15:59
PiRKPushed on Oct 23 2020, 15:59
Reviewer
Restricted Owners Package
Differential Revision
D8083: qa: Fix service flag comparison check in rpc_net test
Parents
rABC1eeffea66ff0: Make signrawtransaction* give an error when amount is needed but missing
Branches
Unknown
Tags
Unknown