lncfg+lnd: add new dev config unsafeconnect

This flag is added so we can use it in the itest to mimic racing inbound
and outbound connections.
This commit is contained in:
yyforyongyu committed 2025-06-18 17:19:09 +08:00
1 parent cc7ed5a9d2
commit 599650fa2d
3 files changed
+17 -1

No files matched your search

+5 -1
View File
@@ -4988,7 +4988,11 @@ func (s *server) ConnectToPeer(addr *lnwire.NetAddress,
// Ensure we're not already connected to this peer.
peer, err := s.findPeerByPubStr(targetPub)
if err == nil {
// When there's no error it means we already have a connection with this
// peer. If this is a dev environment with the `--unsafeconnect` flag
// set, we will ignore the existing connection and continue.
if err == nil && !s.cfg.Dev.GetUnsafeConnect() {
s.mu.Unlock()
return &errPeerAlreadyConnected{peer: peer}
}