Skip to content

No addresses returned by getnodeaddresses RPC call #16990

Closed

Description

@boorac

The issue

I am attempting to use the getnodeaddresses RPC call to return all addresses known by a node in a docker network. I'm using the regtest environment. The RPC call returns an empty array although nodes have been added on the referent node using the add RPC call.

Expected behavior

The getnodeaddresses RPC call should return nodes added via the add RPC call.

Actual behavior

No addresses are returned, i.e., an empty array is returned:

bitcoin-cli -regtest --datadir=/root/.bitcoin/ getnodeaddresses 5
[
]

Reproduction

Setup a regtest network of 11 nodes. No mining has been done, and the ~/.bitcoin folder contains only bitcoin.conf with the following content:

[regtest]
regtest=1
server=1
rpcport=8332
port=8333

Connect to the referent node and run the command:
bitcoin-cli -regtest --datadir=/root/.bitcoin/ addnode "$p:8333" add where p is the other node address for every node the referent node wants to add.

Run the commands on the referent node:

bitcoin-cli -regtest --datadir=/root/.bitcoin/ getconnectioncount
10

bitcoin-cli -regtest --datadir=/root/.bitcoin/ getpeerinfo       

[
  {
    "id": 2,
    "addr": "10.0.0.3:53378",
     # Cut out part of response
{
    "id": 11,
    "addr": "10.0.0.4:36236",
    "addrbind": "10.0.0.2:8333",
    "services": "000000000000040d",
    "relaytxes": true,
    "lastsend": 1569835448,
    "lastrecv": 1569835448,
    "bytessent": 464,
    "bytesrecv": 488,
    "conntime": 1569835207,
    "timeoffset": 0,
    "pingtime": 0.001063,
    "minping": 0.000456,
    "version": 70015,
    "subver": "/Satoshi:0.18.0/",
    "inbound": true,
    "addnode": false,
    "startingheight": 303,
    "banscore": 0,
    "synced_headers": -1,
    "synced_blocks": -1,
    "inflight": [
    ],
    "whitelisted": false,
    "minfeefilter": 0.00001000,
    "bytessent_per_msg": {
      "feefilter": 32,
      "ping": 96,
      "pong": 96,
      "sendcmpct": 66,
      "sendheaders": 24,
      "verack": 24,
      "version": 126
    },
    "bytesrecv_per_msg": {
      "feefilter": 32,
      "getaddr": 24,
      "ping": 96,
      "pong": 96,
      "sendcmpct": 66,
      "sendheaders": 24,
      "verack": 24,
      "version": 126
    }
  }
]

bitcoin-cli -regtest --datadir=/root/.bitcoin getnodeaddresses 5
[
]

Bitcoin core version

bitcoin-cli -version
Bitcoin Core RPC client version v0.18.0.0-g2472733a24a9364e4c6233ccd04166a26a68cc65
bitcoind -version 
Bitcoin Core Daemon version v0.18.0.0-g2472733a24a9364e4c6233ccd04166a26a68cc65

Installed via the repository ppa:bitcoin/bitcoin

OS

Docker container info:

lsb_release -a
No LSB modules are available.
Distributor ID:	Ubuntu
Description:	Ubuntu 18.04.3 LTS
Release:	18.04
Codename:	bionic

Host info:

lsb_release -a
No LSB modules are available.
Distributor ID:	Ubuntu
Description:	Ubuntu 18.04.3 LTS
Release:	18.04
Codename:	bionic

cat /proc/cpuinfo  | grep 'name'| uniq
model name	: Intel(R) Core(TM) i7-4600M CPU @ 2.90GHz

1 TB SSD disk

Activity

  1. maflcko commented on Sep 30, 2019

    @maflcko
    Member

    I think RFC 1918 addresses are not considered routable by addrman and thus not added

  2. boorac commented on Oct 1, 2019

    @boorac
    Author

    I think RFC 1918 addresses are not considered routable by addrman and thus not added

    I was indeed using 10.0.0.0/16 as the docker network subnet, however changing the subnet to something else, e.g. 11.0.0.0/16 or 161.53.0.0/16 yields the same result.

  3. boorac commented on Oct 1, 2019

    @boorac
    Author

    Furthermore, in a network with the subnet 11.0.0.0/16 containing only two nodes, A and B when I replace the add option with the onetry option, I made an interesting observation:

    1. A first mines blocks
    2. B is not connected to A and has height set to 0
    3. B then connects to A and immediately updates the block height to the one known to B
    4. B runs the getnodeaddresses command and still the response is an empty array (same goes for A)

    How come the nodes can exchange blocks but seem to not be connected?

  4. maflcko commented on Oct 1, 2019

    @maflcko
    Member

    How come the nodes can exchange blocks but seem to not be connected?

    connection info can be retrieved with getnetworkinfo and getpeerinfo, not getnodeaddresses

  5. maflcko commented on Oct 1, 2019

    @maflcko
    Member

    changing the subnet to something else, e.g. 11.0.0.0/16 or 161.53.0.0/16 yields the same result.

    Don't know about these, but you might want to check IsRoutable https://dev.visucore.com/bitcoin/doxygen/class_c_net_addr.html#a4e3b2fea2a6151c76684b3812df4a5c3

  6. boorac commented on Oct 2, 2019

    @boorac
    Author

    changing the subnet to something else, e.g. 11.0.0.0/16 or 161.53.0.0/16 yields the same result.

    Don't know about these, but you might want to check IsRoutable https://dev.visucore.com/bitcoin/doxygen/class_c_net_addr.html#a4e3b2fea2a6151c76684b3812df4a5c3

    I tried some debugging with lldb, and have used a subnet 144.217.240.0/24 in my docker setup, which I have derived from the address of bitcoin.sipa.be DNS seed. For example, 144.217.240.5 is declared routable (by IsRoutable), however it is still not returned by getnodeaddresses

  7. boorac commented on Oct 2, 2019

    @boorac
    Author

    How come the nodes can exchange blocks but seem to not be connected?

    connection info can be retrieved with getnetworkinfo and getpeerinfo, not getnodeaddresses

    Maybe I am misunderstanding the protocol, but shouldn't a node that is actively connected be declared as known and as such returned by getnodeaddresses - seems reasonable to me.

  8. maflcko commented on Oct 2, 2019

    @maflcko
    Member

    getnodeaddresses is specifically for returning addresses from addrman (the database), which might include addresses of nodes that are currently connected, but generally those sets are not equal.

  9. maflcko commented on Oct 2, 2019

    @maflcko
    Member

    I tried some debugging with lldb, and have used a subnet 144.217.240.0/24 in my docker setup, which I have derived from the address of bitcoin.sipa.be DNS seed. For example, 144.217.240.5 is declared routable (by IsRoutable), however it is still not returned by getnodeaddresses

    Sorry, can't help here. My knowledge ends there.

  10. maflcko commented on May 8, 2020

    @maflcko
    Member

    Is this still an issue with a recent version of Bitcoin Core? If yes, what are the steps to reproduce?

  11. liorko87 commented on Aug 9, 2020

    @liorko87

    I had the same issue with the latest version (0.20.1).
    When I changed the value of consensus.nMinimumChainWork the problem solved.

  12. locked as resolved and limited conversation to collaborators on Feb 15, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions