File tree Expand file tree Collapse file tree 2 files changed +18
-0
lines changed Expand file tree Collapse file tree 2 files changed +18
-0
lines changed Original file line number Diff line number Diff line change @@ -230,6 +230,10 @@ type ChainArbitratorConfig struct {
230230 // AuxResolver is an optional interface that can be used to modify the
231231 // way contracts are resolved.
232232 AuxResolver fn.Option [lnwallet.AuxContractResolver ]
233+
234+ // AuxCloser is an optional interface that can be used to finalize
235+ // cooperative channel closes.
236+ AuxCloser fn.Option [AuxChanCloser ]
233237}
234238
235239// ChainArbitrator is a sub-system that oversees the on-chain resolution of all
@@ -1138,6 +1142,7 @@ func (c *ChainArbitrator) WatchNewChannel(newChan *channeldb.OpenChannel) error
11381142 extractStateNumHint : lnwallet .GetStateNumHint ,
11391143 auxLeafStore : c .cfg .AuxLeafStore ,
11401144 auxResolver : c .cfg .AuxResolver ,
1145+ auxCloser : c .cfg .AuxCloser ,
11411146 },
11421147 )
11431148 if err != nil {
@@ -1315,6 +1320,7 @@ func (c *ChainArbitrator) loadOpenChannels() error {
13151320 extractStateNumHint : lnwallet .GetStateNumHint ,
13161321 auxLeafStore : c .cfg .AuxLeafStore ,
13171322 auxResolver : c .cfg .AuxResolver ,
1323+ auxCloser : c .cfg .AuxCloser ,
13181324 },
13191325 )
13201326 if err != nil {
Original file line number Diff line number Diff line change @@ -24,6 +24,7 @@ import (
2424 "github.com/lightningnetwork/lnd/lntypes"
2525 "github.com/lightningnetwork/lnd/lnutils"
2626 "github.com/lightningnetwork/lnd/lnwallet"
27+ "github.com/lightningnetwork/lnd/lnwallet/types"
2728 "github.com/lightningnetwork/lnd/lnwire"
2829)
2930
@@ -37,6 +38,14 @@ const (
3738 maxCommitPointPollTimeout = 10 * time .Minute
3839)
3940
41+ // AuxChanCloser is used to allow an external caller to finalize a cooperative
42+ // channel close.
43+ type AuxChanCloser interface {
44+ // FinalizeClose is called after the close transaction has been agreed
45+ // upon and confirmed.
46+ FinalizeClose (desc types.AuxCloseDesc , closeTx * wire.MsgTx ) error
47+ }
48+
4049// LocalUnilateralCloseInfo encapsulates all the information we need to act on
4150// a local force close that gets confirmed.
4251type LocalUnilateralCloseInfo struct {
@@ -229,6 +238,9 @@ type chainWatcherConfig struct {
229238
230239 // auxResolver is used to supplement contract resolution.
231240 auxResolver fn.Option [lnwallet.AuxContractResolver ]
241+
242+ // auxCloser is used to finalize cooperative closes.
243+ auxCloser fn.Option [AuxChanCloser ]
232244}
233245
234246// chainWatcher is a system that's assigned to every active channel. The duty
You can’t perform that action at this time.
0 commit comments