diff --git a/contractcourt/anchor_resolver.go b/contractcourt/anchor_resolver.go index c59e5d063..7e2676782 100644 --- a/contractcourt/anchor_resolver.go +++ b/contractcourt/anchor_resolver.go @@ -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, }, ) diff --git a/sweep/sweeper.go b/sweep/sweeper.go index fdaecbefb..1058c9503 100644 --- a/sweep/sweeper.go +++ b/sweep/sweeper.go @@ -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