mirror of
https://github.com/lightningnetwork/lnd.git
synced 2025-10-04 16:53:20 +02:00
contractcourt: make empty htlcSets for closed channels
This prevents a panic where an insert is attempted on a nil map via updateActiveHTLCs. This panic would occur if the channel arbitrator was in a buggy state, possibly introduced by power loss or via SIGKILL.
This commit is contained in:
@@ -601,11 +601,13 @@ func (c *ChainArbitrator) Start() error {
|
|||||||
return c.ResolveContract(chanPoint)
|
return c.ResolveContract(chanPoint)
|
||||||
}
|
}
|
||||||
|
|
||||||
// We can also leave off the set of HTLC's here as since the
|
// We create an empty map of HTLC's here since it's possible
|
||||||
// channel is already in the process of being full resolved, no
|
// that the channel is in StateDefault and updateActiveHTLCs is
|
||||||
// new HTLC's will be added.
|
// called. We want to avoid writing to an empty map. Since the
|
||||||
|
// channel is already in the process of being resolved, no new
|
||||||
|
// HTLCs will be added.
|
||||||
c.activeChannels[chanPoint] = NewChannelArbitrator(
|
c.activeChannels[chanPoint] = NewChannelArbitrator(
|
||||||
arbCfg, nil, chanLog,
|
arbCfg, make(map[HtlcSetKey]htlcSet), chanLog,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user