Lnd: URIs incorrectly announced to network

Created on 31 Jan 2018  路  4Comments  路  Source: lightningnetwork/lnd

It would have been so cool if I could make my first pull request with this but I'm currently lacking sufficient knowledge of go-lang to do this. So here it is.

The uris seems to be incorrectly broadcasted. It announces the 9735 port while my node is configured to listen on 19736.

lnd@dawson:~$ lncli getinfo
{
    "identity_pubkey": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
    "alias": "xxxxx",
    "num_pending_channels": 0,
    "num_active_channels": 21,
    "num_peers": 21,
    "block_height": 1261536,
    "block_hash": "00000000000002472ce5928b99e07b89e8f34effd4c9a117a7eaf1e7aa839a15",
    "synced_to_chain": false,
    "testnet": true,
    "chains": [
        "bitcoin"
    ],
    "uris": [
        "[email protected]:9735"
    ]
}
lnd@dawson:~$ netstat -tulpen | grep lnd
tcp        0      0 127.0.0.1:8080          0.0.0.0:*               LISTEN      1003       83435156   28606/lnd           
tcp        0      0 127.0.0.1:10009         0.0.0.0:*               LISTEN      1003       83435153   28606/lnd           
tcp6       0      0 :::19736                :::*                    LISTEN      1003       83435150   28606/lnd   

This problem is caused by the externalIP parameter in lnd.conf. If it is configured without the port X.X.X.X it will announce X.X.X.X:9735 as uri to the network. Even when lnd is configured to listen on another port. Configuration example below.

Announcing it is running on 9735

externalip=X.X.X.X
alias=XXX
color=#00FF00
listen=0.0.0.0:19736

Announcing it is running on 19736

externalip=X.X.X.X:19736
alias=XXXX
color=#00FF00
listen=0.0.0.0:19736

After this change it is broadcasted correctly:

lnd@dawson:~$ lncli getinfo
{
    "identity_pubkey": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
    "alias": "xxxxx",
    "num_pending_channels": 0,
    "num_active_channels": 20,
    "num_peers": 20,
    "block_height": 1261541,
    "block_hash": "00000000000007ac403f2f1af276f2b4de9ed2011ce124a878c06f00e71b57f0",
    "synced_to_chain": false,
    "testnet": true,
    "chains": [
        "bitcoin"
    ],
    "uris": [
        "[email protected]:19736"
    ]
}

I'm guessing its something with the code in the server.go file. Around line 217.

Most helpful comment

Hmm, I see. Yeh the documentation there could use a bit of elaboration. Even if you have another node listening on 9735, you can use an external port, so: --externalip=0.0.0.0:12099 (or w/e port).

All 4 comments

The default port on the network is 9735. If you don't specify an IP, then it assumes the default port. It doesn't consult what you set for listen as it's possible you're actually accepting connections on some external IP, which is then proxied to the interface specified for listen.

Hmmm right. Maybe this needs some explanation because the help doesn't mention it. In my case port 9735 is used by another proces (lightning node on mainnet).

--externalip=                            
Add an ip to the list of local addresses we claim to listen on to peers

Hmm, I see. Yeh the documentation there could use a bit of elaboration. Even if you have another node listening on 9735, you can use an external port, so: --externalip=0.0.0.0:12099 (or w/e port).

Was this page helpful?
0 / 5 - 0 ratings

Related issues

AnthonyRonning picture AnthonyRonning  路  3Comments

hxsquid picture hxsquid  路  3Comments

whizz picture whizz  路  3Comments

alec-djinn picture alec-djinn  路  3Comments

pm47 picture pm47  路  3Comments