build: update to version of neutrino w/ BIP 155 support

Fixes #4973
This commit is contained in:
Olaoluwa Osuntokun committed 2022-05-03 15:48:37 -07:00
1 parent 54adc6996b
commit 9ec26325b5
5 files changed
+16 -46

No files matched your search

+1 -33
View File
@@ -35,7 +35,6 @@ import (
"github.com/lightningnetwork/lnd/macaroons"
"github.com/lightningnetwork/lnd/rpcperms"
"github.com/lightningnetwork/lnd/signal"
"github.com/lightningnetwork/lnd/tor"
"github.com/lightningnetwork/lnd/walletunlocker"
"github.com/lightningnetwork/lnd/watchtower"
"github.com/lightningnetwork/lnd/watchtower/wtclient"
@@ -1201,43 +1200,12 @@ func initNeutrinoBackend(cfg *Config, chainDir string,
AddPeers: cfg.NeutrinoMode.AddPeers,
ConnectPeers: cfg.NeutrinoMode.ConnectPeers,
Dialer: func(addr net.Addr) (net.Conn, error) {
dialAddr := addr
if tor.IsOnionFakeIP(addr) {
// Because the Neutrino address manager only
// knows IP addresses, we need to turn any fake
// tcp6 address that actually encodes an Onion
// v2 address back into the hostname
// representation before we can pass it to the
// dialer.
var err error
dialAddr, err = tor.FakeIPToOnionHost(addr)
if err != nil {
return nil, err
}
}
return cfg.net.Dial(
dialAddr.Network(), dialAddr.String(),
addr.Network(), addr.String(),
cfg.ConnectionTimeout,
)
},
NameResolver: func(host string) ([]net.IP, error) {
if tor.IsOnionHost(host) {
// Neutrino internally uses btcd's address
// manager which only operates on an IP level
// and does not understand onion hosts. We need
// to turn an onion host into a fake
// representation of an IP address to make it
// possible to connect to a block filter backend
// that serves on an Onion v2 hidden service.
fakeIP, err := tor.OnionHostToFakeIP(host)
if err != nil {
return nil, err
}
return []net.IP{fakeIP}, nil
}
addrs, err := cfg.net.LookupHost(host)
if err != nil {
return nil, err