funding+lnd: ensure we reconnect to new channel peers

In this commit, we fix a minor bug in the prior versions of lnd. Before
this commit, if we received a new inbound connection for channel
creation, the channel was created, and then the peer disconnected, we
wouldn't automatically reconnect.

In this commit we fix this issue by overloading the WatchNewChannel
method to also accept the peer's ID so we can add it to the set of
persistent connections.
This commit is contained in:
Olaoluwa Osuntokun committed 2018-03-30 18:42:40 -07:00
1 parent d34c37f3dd
commit 956d20ebdc
2 files changed
+21 -8

No files matched your search

+14 -1
View File
@@ -430,7 +430,20 @@ func lndMain() error {
}
return delay
},
WatchNewChannel: server.chainArb.WatchNewChannel,
WatchNewChannel: func(channel *channeldb.OpenChannel,
addr *lnwire.NetAddress) error {
// First, we'll mark this new peer as a persistent
// re-connection purposes.
server.mu.Lock()
pubStr := string(addr.IdentityKey.SerializeCompressed())
server.persistentPeers[pubStr] = struct{}{}
server.mu.Unlock()
// With that taken care of, we'll send this channel to
// the chain arb so it can react to on-chain events.
return server.chainArb.WatchNewChannel(channel)
},
ReportShortChanID: func(chanPoint wire.OutPoint,
sid lnwire.ShortChannelID) error {