mirror of
https://github.com/lightningnetwork/lnd.git
synced 2025-06-19 05:11:25 +02: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
@ -158,6 +158,15 @@ type ChainArbitratorConfig struct {
|
|||||||
// will use to notify the ChannelNotifier about a newly closed channel.
|
// will use to notify the ChannelNotifier about a newly closed channel.
|
||||||
NotifyClosedChannel func(wire.OutPoint)
|
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
|
// OnionProcessor is used to decode onion payloads for on-chain
|
||||||
// resolution.
|
// resolution.
|
||||||
OnionProcessor OnionProcessor
|
OnionProcessor OnionProcessor
|
||||||
@ -366,6 +375,10 @@ func newActiveChannelArbitrator(channel *channeldb.OpenChannel,
|
|||||||
}
|
}
|
||||||
|
|
||||||
arbCfg.MarkChannelResolved = func() error {
|
arbCfg.MarkChannelResolved = func() error {
|
||||||
|
if c.cfg.NotifyFullyResolvedChannel != nil {
|
||||||
|
c.cfg.NotifyFullyResolvedChannel(chanPoint)
|
||||||
|
}
|
||||||
|
|
||||||
return c.ResolveContract(chanPoint)
|
return c.ResolveContract(chanPoint)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -566,6 +579,10 @@ func (c *ChainArbitrator) Start() error {
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
arbCfg.MarkChannelResolved = func() error {
|
arbCfg.MarkChannelResolved = func() error {
|
||||||
|
if c.cfg.NotifyFullyResolvedChannel != nil {
|
||||||
|
c.cfg.NotifyFullyResolvedChannel(chanPoint)
|
||||||
|
}
|
||||||
|
|
||||||
return c.ResolveContract(chanPoint)
|
return c.ResolveContract(chanPoint)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1004,6 +1004,7 @@ func newServer(cfg *Config, listenAddrs []net.Addr,
|
|||||||
Sweeper: s.sweeper,
|
Sweeper: s.sweeper,
|
||||||
Registry: s.invoices,
|
Registry: s.invoices,
|
||||||
NotifyClosedChannel: s.channelNotifier.NotifyClosedChannelEvent,
|
NotifyClosedChannel: s.channelNotifier.NotifyClosedChannelEvent,
|
||||||
|
NotifyFullyResolvedChannel: s.channelNotifier.NotifyFullyResolvedChannelEvent,
|
||||||
OnionProcessor: s.sphinx,
|
OnionProcessor: s.sphinx,
|
||||||
PaymentsExpirationGracePeriod: cfg.PaymentsExpirationGracePeriod,
|
PaymentsExpirationGracePeriod: cfg.PaymentsExpirationGracePeriod,
|
||||||
IsForwardedHTLC: s.htlcSwitch.IsForwardedHTLC,
|
IsForwardedHTLC: s.htlcSwitch.IsForwardedHTLC,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user