From 1c65c3d072683da78be15beb257db0ee91bc5b8c Mon Sep 17 00:00:00 2001 From: Elle Mouton Date: Thu, 13 Jun 2024 14:27:06 -0400 Subject: [PATCH 1/2] funding: allow AcceptChannel with min depth of zero Even if the channel type is not zero conf. We will still use a min depth of at least 1. We just dont fail if our peer indicates trust. --- funding/manager.go | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/funding/manager.go b/funding/manager.go index c3a839277a..67e4f33c5c 100644 --- a/funding/manager.go +++ b/funding/manager.go @@ -2020,19 +2020,22 @@ func (f *Manager) funderProcessAcceptChannel(peer lnpeer.Peer, return } - // Fail early if minimum depth is set to 0 and the channel is not - // zero-conf. - if !resCtx.reservation.IsZeroConf() && msg.MinAcceptDepth == 0 { - err = fmt.Errorf("non-zero-conf channel has min depth zero") - log.Warn(err) - f.failFundingFlow(peer, cid, err) - return + // If this is not a zero-conf channel but the peer responded with a + // min-depth of zero, we will use our minimum of 1 instead. + minDepth := msg.MinAcceptDepth + if !resCtx.reservation.IsZeroConf() && minDepth == 0 { + log.Infof("Responder to pending_id=%v sent a minimum "+ + "confirmation depth of 0 for non-zero-conf channel. "+ + "We will use a minimum depth of 1 instead.", + cid.tempChanID) + + minDepth = 1 } // We'll also specify the responder's preference for the number of // required confirmations, and also the set of channel constraints // they've specified for commitment states we can create. - resCtx.reservation.SetNumConfsRequired(uint16(msg.MinAcceptDepth)) + resCtx.reservation.SetNumConfsRequired(uint16(minDepth)) channelConstraints := &channeldb.ChannelConstraints{ DustLimit: msg.DustLimit, ChanReserve: msg.ChannelReserve, From 9d1320a2d09d03cc43f185bffaae83a0d71e53fa Mon Sep 17 00:00:00 2001 From: Elle Mouton Date: Thu, 13 Jun 2024 14:34:07 -0400 Subject: [PATCH 2/2] docs: add release notes entry --- docs/release-notes/release-notes-0.18.2.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/docs/release-notes/release-notes-0.18.2.md b/docs/release-notes/release-notes-0.18.2.md index 78370fc25e..e2216bc700 100644 --- a/docs/release-notes/release-notes-0.18.2.md +++ b/docs/release-notes/release-notes-0.18.2.md @@ -84,6 +84,11 @@ [support the TLV onion format](https://github.com/lightningnetwork/lnd/pull/8791). +* Allow channel fundee to send a [minimum confirmation depth of + 0](https://github.com/lightningnetwork/lnd/pull/8796) for a non-zero-conf + channel. We will still wait for the channel to have at least one confirmation + and so the main change here is that we don't error out for such a case. + ## Testing ## Database ## Code Health