mirror of
https://github.com/lightningnetwork/lnd.git
synced 2025-08-27 14:11:04 +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:
committed by
Oliver Gugger
parent
558ea0f895
commit
28af39cd03
@@ -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 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
|
// 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
|
// We also clear the parent tx information for cpfp, because the
|
||||||
// commitment tx is confirmed.
|
// commitment tx is confirmed.
|
||||||
@@ -222,6 +225,8 @@ func (c *anchorResolver) Launch() error {
|
|||||||
c.broadcastHeight, nil,
|
c.broadcastHeight, nil,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
exclusiveGroup := c.ShortChanID.ToUint64()
|
||||||
|
|
||||||
resultChan, err := c.Sweeper.SweepInput(
|
resultChan, err := c.Sweeper.SweepInput(
|
||||||
&anchorInput,
|
&anchorInput,
|
||||||
sweep.Params{
|
sweep.Params{
|
||||||
@@ -233,6 +238,10 @@ func (c *anchorResolver) Launch() error {
|
|||||||
// There's no rush to sweep the anchor, so we use a nil
|
// There's no rush to sweep the anchor, so we use a nil
|
||||||
// deadline here.
|
// deadline here.
|
||||||
DeadlineHeight: fn.None[int32](),
|
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.
|
// Params contains the parameters that control the sweeping process.
|
||||||
type Params struct {
|
type Params struct {
|
||||||
// ExclusiveGroup is an identifier that, if set, prevents other inputs
|
// ExclusiveGroup is an identifier that, if set, ensures this input is
|
||||||
// with the same identifier from being batched together.
|
// swept in a transaction by itself, and not batched with any other
|
||||||
|
// inputs.
|
||||||
ExclusiveGroup *uint64
|
ExclusiveGroup *uint64
|
||||||
|
|
||||||
// DeadlineHeight specifies an absolute block height that this input
|
// DeadlineHeight specifies an absolute block height that this input
|
||||||
|
Reference in New Issue
Block a user