mirror of
https://github.com/lightningnetwork/lnd.git
synced 2025-02-21 22:11:41 +01:00
server+contractcourt: signal channel fully resolved
We might want to react to a channel being fully resolved after being involved in a force close. For this we add a new callback and invoke it where appropriate.
This commit is contained in:
parent
dcff9e5e26
commit
7e68cae8bd
2 changed files with 18 additions and 0 deletions
|
@ -158,6 +158,15 @@ type ChainArbitratorConfig struct {
|
|||
// will use to notify the ChannelNotifier about a newly closed channel.
|
||||
NotifyClosedChannel func(wire.OutPoint)
|
||||
|
||||
// NotifyFullyResolvedChannel is a function closure that the
|
||||
// ChainArbitrator will use to notify the ChannelNotifier about a newly
|
||||
// resolved channel. The main difference to NotifyClosedChannel is that
|
||||
// in case of a local force close the NotifyClosedChannel is called when
|
||||
// the published commitment transaction confirms while
|
||||
// NotifyFullyResolvedChannel is only called when the channel is fully
|
||||
// resolved (which includes sweeping any time locked funds).
|
||||
NotifyFullyResolvedChannel func(point wire.OutPoint)
|
||||
|
||||
// OnionProcessor is used to decode onion payloads for on-chain
|
||||
// resolution.
|
||||
OnionProcessor OnionProcessor
|
||||
|
@ -366,6 +375,10 @@ func newActiveChannelArbitrator(channel *channeldb.OpenChannel,
|
|||
}
|
||||
|
||||
arbCfg.MarkChannelResolved = func() error {
|
||||
if c.cfg.NotifyFullyResolvedChannel != nil {
|
||||
c.cfg.NotifyFullyResolvedChannel(chanPoint)
|
||||
}
|
||||
|
||||
return c.ResolveContract(chanPoint)
|
||||
}
|
||||
|
||||
|
@ -566,6 +579,10 @@ func (c *ChainArbitrator) Start() error {
|
|||
return err
|
||||
}
|
||||
arbCfg.MarkChannelResolved = func() error {
|
||||
if c.cfg.NotifyFullyResolvedChannel != nil {
|
||||
c.cfg.NotifyFullyResolvedChannel(chanPoint)
|
||||
}
|
||||
|
||||
return c.ResolveContract(chanPoint)
|
||||
}
|
||||
|
||||
|
|
|
@ -1004,6 +1004,7 @@ func newServer(cfg *Config, listenAddrs []net.Addr,
|
|||
Sweeper: s.sweeper,
|
||||
Registry: s.invoices,
|
||||
NotifyClosedChannel: s.channelNotifier.NotifyClosedChannelEvent,
|
||||
NotifyFullyResolvedChannel: s.channelNotifier.NotifyFullyResolvedChannelEvent,
|
||||
OnionProcessor: s.sphinx,
|
||||
PaymentsExpirationGracePeriod: cfg.PaymentsExpirationGracePeriod,
|
||||
IsForwardedHTLC: s.htlcSwitch.IsForwardedHTLC,
|
||||
|
|
Loading…
Add table
Reference in a new issue