Skip to content

bitcoin-cli -netinfo ignores inbound peer from local network #26579

@pinheadmz

Description

@pinheadmz

I have bitcoind serving cfilters to an LND node on my local network on separate machines. Both have 192.168.1.x IP addresses and they connect fine using neutrino. However, the LND node does not appear in the bitcoin-cli -netinfo table.

The reason is because if you look at the getpeerinfo response:

{
  "id": 11728,
  "addr": "192.168.1.153:64367",
  "addrbind": "192.168.1.13:8333",
  "addrlocal": "192.168.1.13:8333",
  "network": "not_publicly_routable",
  "services": "0000000000000048",
  "servicesnames": [
    "WITNESS",
    "COMPACT_FILTERS"
  ],
...

...so bitcoin-cli ignores the peer here:

bitcoin/src/bitcoin-cli.cpp

Lines 477 to 479 in 9c47eb4

const std::string network{peer["network"].get_str()};
const int8_t network_id{NetworkStringToId(network)};
if (network_id == UNKNOWN_NETWORK) continue;

...expecting one of these strings only:

static constexpr std::array NETWORKS{"ipv4", "ipv6", "onion", "i2p", "cjdns"};

I'm happy to fix / add this myself unless there's a reason? Maybe instead of skipping the peer we can just add an "unknown network" category, or "other" ...?

cc: @jonatack

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions