mirror of
https://github.com/lightningnetwork/lnd.git
synced 2025-08-29 15:11:09 +02:00
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.
This commit is contained in:
@@ -2020,19 +2020,22 @@ func (f *Manager) funderProcessAcceptChannel(peer lnpeer.Peer,
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
// Fail early if minimum depth is set to 0 and the channel is not
|
// If this is not a zero-conf channel but the peer responded with a
|
||||||
// zero-conf.
|
// min-depth of zero, we will use our minimum of 1 instead.
|
||||||
if !resCtx.reservation.IsZeroConf() && msg.MinAcceptDepth == 0 {
|
minDepth := msg.MinAcceptDepth
|
||||||
err = fmt.Errorf("non-zero-conf channel has min depth zero")
|
if !resCtx.reservation.IsZeroConf() && minDepth == 0 {
|
||||||
log.Warn(err)
|
log.Infof("Responder to pending_id=%v sent a minimum "+
|
||||||
f.failFundingFlow(peer, cid, err)
|
"confirmation depth of 0 for non-zero-conf channel. "+
|
||||||
return
|
"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
|
// We'll also specify the responder's preference for the number of
|
||||||
// required confirmations, and also the set of channel constraints
|
// required confirmations, and also the set of channel constraints
|
||||||
// they've specified for commitment states we can create.
|
// they've specified for commitment states we can create.
|
||||||
resCtx.reservation.SetNumConfsRequired(uint16(msg.MinAcceptDepth))
|
resCtx.reservation.SetNumConfsRequired(uint16(minDepth))
|
||||||
channelConstraints := &channeldb.ChannelConstraints{
|
channelConstraints := &channeldb.ChannelConstraints{
|
||||||
DustLimit: msg.DustLimit,
|
DustLimit: msg.DustLimit,
|
||||||
ChanReserve: msg.ChannelReserve,
|
ChanReserve: msg.ChannelReserve,
|
||||||
|
Reference in New Issue
Block a user