Page MenuHomePhabricator

qa: Fix service flag comparison check in rpc_net test
ClosedPublic

Authored by PiRK on Oct 23 2020, 14:33.

Details

Reviewers
deadalnix
Fabien
Group Reviewers
Restricted Owners Package(Owns No Changed Paths)
Restricted Project
Commits
rABC93159fb940fb: 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
>>> 

Diff Detail

Repository
rABC Bitcoin ABC
Lint
Lint Not Applicable
Unit
Tests Not Applicable