mirror of
https://github.com/lightningnetwork/lnd.git
synced 2025-08-25 05:02:32 +02:00
contractcourt+sweep: make anchor inputs exclusive
We now make sure to sweep each anchor input in its own sweeping tx, if economically feasible.
This commit is contained in:
@@ -202,7 +202,10 @@ func (c *anchorResolver) Launch() error {
|
||||
// an output that we want to sweep only if it is economical to do so.
|
||||
//
|
||||
// An exclusive group is not necessary anymore, because we know that
|
||||
// this is the only anchor that can be swept.
|
||||
// this is the only anchor that can be swept. However, to avoid this
|
||||
// anchor input being group with other inputs, we still keep the
|
||||
// exclusive group here such that the anchor will be swept
|
||||
// independently.
|
||||
//
|
||||
// We also clear the parent tx information for cpfp, because the
|
||||
// commitment tx is confirmed.
|
||||
@@ -222,6 +225,8 @@ func (c *anchorResolver) Launch() error {
|
||||
c.broadcastHeight, nil,
|
||||
)
|
||||
|
||||
exclusiveGroup := c.ShortChanID.ToUint64()
|
||||
|
||||
resultChan, err := c.Sweeper.SweepInput(
|
||||
&anchorInput,
|
||||
sweep.Params{
|
||||
@@ -233,6 +238,10 @@ func (c *anchorResolver) Launch() error {
|
||||
// There's no rush to sweep the anchor, so we use a nil
|
||||
// deadline here.
|
||||
DeadlineHeight: fn.None[int32](),
|
||||
|
||||
// Use the chan id as the exclusive group. This prevents
|
||||
// any of the anchors from being batched together.
|
||||
ExclusiveGroup: &exclusiveGroup,
|
||||
},
|
||||
)
|
||||
|
||||
|
@@ -45,8 +45,9 @@ var (
|
||||
|
||||
// Params contains the parameters that control the sweeping process.
|
||||
type Params struct {
|
||||
// ExclusiveGroup is an identifier that, if set, prevents other inputs
|
||||
// with the same identifier from being batched together.
|
||||
// ExclusiveGroup is an identifier that, if set, ensures this input is
|
||||
// swept in a transaction by itself, and not batched with any other
|
||||
// inputs.
|
||||
ExclusiveGroup *uint64
|
||||
|
||||
// DeadlineHeight specifies an absolute block height that this input
|
||||
|
Reference in New Issue
Block a user