mynodebtc / mynode

The easiest way to run Bitcoin and Lightning!
Other
646 stars 148 forks source link

Turning "USE TOR FOR BITCOIN AND LIGHTNING" off loses the lnd URI #698

Open HamishMacEwan opened 1 year ago

HamishMacEwan commented 1 year ago

With the current issues on keeping channels up and peers in touch over Tor, consideration was giving to flicking the switch in Settings regarding "USE TOR FOR BITCOIN AND LIGHTNING" and going clearnet until the trouble with Tor subsides.

After turning the option to use Tor off and the reboot, when the system returned there was no URI on the lnd status page, nor in the

lncli getinfo

output, only

    "uris": [
    ],

Describe the solution you'd like Expected that turning off the use of Tor would result in a clearnet IP address being provided with the public key and port in the lnd URI.

The closest I found was the request for a hybrid option https://github.com/mynodebtc/mynode/issues/678 which I support.

tehelsper commented 1 year ago

if you run "lncli getinfo" do you see anything? It may be router-related. I do see an IP address in the URI of one of my nodes, but I know LND also has a way to specify the external IP in the config.

See "externalip" and the "nat" comment in the config. https://github.com/lightningnetwork/lnd/blob/master/sample-lnd.conf#L166

tehelsper commented 1 year ago

Also, I believe the IP toggle has a downside I just became aware of. If you peers were tor-only and you swap to clearnet, some peer connections may not be able to go active after swapping.

HamishMacEwan commented 1 year ago

if you run "lncli getinfo" do you see anything?

The output quoted was from lncli getinfo and there's no URI there either.

It may be router-related.

It what way? That lnd is not able to determine the external IP from inside the network? OK, I'll look at changing those options.

If you peers were tor-only and you swap to clearnet, some peer connections may not be able to go active after swapping.

admin@flat6:~ $ lncli listpeers | grep \"address\"
            "address": "144.76.24.71:9735",
            "address": "157.90.133.235:8888",
            "address": "3.122.40.122:9735",
admin@flat6:~ $

Looks like we're OK there.

tehelsper commented 1 year ago

Yeah, according to the comments in the lnd sample conf the NAT-PMP or UPNP protocol may not be supported in a way that lets LND know what the external IP address is.

The bigger problem would be is any channel peers had been tor-only they would no longer appear. But, if that list of peers is the same as it was before, you should be good.

tlindi commented 1 year ago

From what I now get with

lncli getinfo

{
    "version": "0.15.5-beta commit=v0.15.5-beta",
    ...
    "alias": "_mynode.correct-DNS.hostname_",
    ...
        "uris": [
        "_nodeid_@_mypublicIPaddrs_:9735"
    ],
....}

My lnd.conf is reset to default (from UI), Tor disabled for LND from UI. Conf end from UI looks like this:

[Application Options]
# Your router must support and enable UPnP
nat=true

# Tor-only by default
listen=0.0.0.0

[Tor]
tor.active=false

# Extra LND Config
[Application Options]

# Self Made Customizations onto file
# /mnt/hdd/mynode/settings/lnd_extra_config.conf

[Application Options]
tlsextradomain=_mynode.correct-DNS.hostname_

# Enables LNbits accounts to pay to each others
allow-circular-route=1 

# End of self Made Customizations 

[Application Options]
tlsextradomain=_longSTRofChars_.onion
tlsextradomain=host.docker.internal

And URI is shown correctly on UI.