contractcourt: add Launch method to anchor/breach resolver

We will use this and its following commits to break the original
`Resolve` methods into two parts - the first part is moved to a new
method `Launch`, which handles sending a sweep request to the sweeper.
The second part remains in `Resolve`, which is mainly waiting for a
spending tx.

Breach resolver currently doesn't do anything in its `Launch` since the
sweeping of justice outputs are not handled by the sweeper yet.
This commit is contained in:
yyforyongyu committed 2024-12-20 17:54:04 +08:00
1 parent 730b605ed4
commit a98763494f
3 files changed
+153 -87

No files matched your search

+10
View File
@@ -10,6 +10,7 @@ import (
"github.com/btcsuite/btclog/v2"
"github.com/lightningnetwork/lnd/channeldb"
"github.com/lightningnetwork/lnd/fn/v2"
"github.com/lightningnetwork/lnd/sweep"
)
var (
@@ -109,6 +110,15 @@ type contractResolverKit struct {
log btclog.Logger
quit chan struct{}
// sweepResultChan is the result chan returned from calling
// `SweepInput`. It should be mounted to the specific resolver once the
// input has been offered to the sweeper.
sweepResultChan chan sweep.Result
// launched specifies whether the resolver has been launched. Calling
// `Launch` will be a no-op if this is true.
launched bool
}
// newContractResolverKit instantiates the mix-in struct.