Skip to content

Commit

Permalink
Merge pull request #8796 from ellemouton/acceptImplicitZeroConf
Browse files Browse the repository at this point in the history
multi: allow min-depth of zero for non-zero conf channels
  • Loading branch information
ellemouton committed Jun 28, 2024
2 parents c34c042 + 9d1320a commit 71ba355
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 8 deletions.
5 changes: 5 additions & 0 deletions docs/release-notes/release-notes-0.18.2.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
19 changes: 11 additions & 8 deletions funding/manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit 71ba355

Please sign in to comment.