Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Handle multiple network ports #2

Open
nkuba opened this issue Oct 28, 2022 · 0 comments
Open

Handle multiple network ports #2

nkuba opened this issue Oct 28, 2022 · 0 comments
Labels

Comments

@nkuba
Copy link
Member

nkuba commented Oct 28, 2022

When the discovery is getting a network port for a peer it assumes the network port is the same in all multi addresses. Which is a correct assumption:

prometheus-sd/main.go

Lines 219 to 222 in ba82128

// A peer can operate on only one network port, so we're not
// collecting all the ports extracted from the multi addresses
// but just one, as all the extracted ports should match.
peersNetworkPorts[peer.ChainAddress] = peerNetworkPort

But it turned out that the data returned on testnet were not following this assumption in one case💥 :

{
    "chain_address": "0x3FF855895EF4aC833c32Ab6A0d6C7fBfA137E26E",
    "multiaddrs":
    [
        "/ip4/127.0.0.1/tcp/3919",
        "/ip4/104.154.211.185/tcp/3307",
        "/ip4/10.102.1.79/tcp/3919"
    ],
    "network_id": "16Uiu2HAm8KJX32kr3eYUhDuzwTucSfAfspnjnXNf9veVhB12t6Vf"
}

The discovery should be more flexible and let the network port be a set of ports just like we do with the addresses and check one port after another when trying to dial the peer.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant