Skip to content

Commit 71ba355

Browse files
authored
Merge pull request #8796 from ellemouton/acceptImplicitZeroConf
multi: allow min-depth of zero for non-zero conf channels
2 parents c34c042 + 9d1320a commit 71ba355

File tree

2 files changed

+16
-8
lines changed

2 files changed

+16
-8
lines changed

docs/release-notes/release-notes-0.18.2.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,11 @@
8484
[support the TLV onion
8585
format](https://github.com/lightningnetwork/lnd/pull/8791).
8686

87+
* Allow channel fundee to send a [minimum confirmation depth of
88+
0](https://github.com/lightningnetwork/lnd/pull/8796) for a non-zero-conf
89+
channel. We will still wait for the channel to have at least one confirmation
90+
and so the main change here is that we don't error out for such a case.
91+
8792
## Testing
8893
## Database
8994
## Code Health

funding/manager.go

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2020,19 +2020,22 @@ func (f *Manager) funderProcessAcceptChannel(peer lnpeer.Peer,
20202020
return
20212021
}
20222022

2023-
// Fail early if minimum depth is set to 0 and the channel is not
2024-
// zero-conf.
2025-
if !resCtx.reservation.IsZeroConf() && msg.MinAcceptDepth == 0 {
2026-
err = fmt.Errorf("non-zero-conf channel has min depth zero")
2027-
log.Warn(err)
2028-
f.failFundingFlow(peer, cid, err)
2029-
return
2023+
// If this is not a zero-conf channel but the peer responded with a
2024+
// min-depth of zero, we will use our minimum of 1 instead.
2025+
minDepth := msg.MinAcceptDepth
2026+
if !resCtx.reservation.IsZeroConf() && minDepth == 0 {
2027+
log.Infof("Responder to pending_id=%v sent a minimum "+
2028+
"confirmation depth of 0 for non-zero-conf channel. "+
2029+
"We will use a minimum depth of 1 instead.",
2030+
cid.tempChanID)
2031+
2032+
minDepth = 1
20302033
}
20312034

20322035
// We'll also specify the responder's preference for the number of
20332036
// required confirmations, and also the set of channel constraints
20342037
// they've specified for commitment states we can create.
2035-
resCtx.reservation.SetNumConfsRequired(uint16(msg.MinAcceptDepth))
2038+
resCtx.reservation.SetNumConfsRequired(uint16(minDepth))
20362039
channelConstraints := &channeldb.ChannelConstraints{
20372040
DustLimit: msg.DustLimit,
20382041
ChanReserve: msg.ChannelReserve,

0 commit comments

Comments
 (0)