lnd: improve code comment

This commit is contained in:
ziggie
2025-06-24 16:52:55 +02:00
parent 409561ac62
commit 24e3958a0b

View File

@@ -1870,11 +1870,13 @@ func (r *rpcServer) DisconnectPeer(ctx context.Context,
// In order to avoid erroneously disconnecting from a peer that we have
// an active channel with, if we have any channels active with this
// peer, then we'll disallow disconnecting from them.
// peer, then we'll disallow disconnecting from them in certain
// situations.
if len(nodeChannels) != 0 {
// If we are not in a dev environment or the configed dev value
// `unsafedisconnect` is false, we return an error since there
// are active channels.
// If the configured dev value `unsafedisconnect` is false, we
// return an error since there are active channels. For
// production environments, we allow disconnecting from a peer
// even if there are channels active with them.
if !r.cfg.Dev.GetUnsafeDisconnect() {
return nil, fmt.Errorf("cannot disconnect from "+
"peer(%x), still has %d active channels",