diff --git a/sweep/sweeper.go b/sweep/sweeper.go index 1219a2919..2530306fe 100644 --- a/sweep/sweeper.go +++ b/sweep/sweeper.go @@ -459,9 +459,11 @@ func (s *UtxoSweeper) SweepInput(input input.Input, return nil, err } + absoluteTimeLock, _ := input.RequiredLockTime() log.Infof("Sweep request received: out_point=%v, witness_type=%v, "+ - "time_lock=%v, amount=%v, params=(%v)", - input.OutPoint(), input.WitnessType(), input.BlocksToMaturity(), + "relative_time_lock=%v, absolute_time_lock=%v, amount=%v, "+ + "params=(%v)", input.OutPoint(), input.WitnessType(), + input.BlocksToMaturity(), absoluteTimeLock, btcutil.Amount(input.SignDesc().Output.Value), params) sweeperInput := &sweepInputMessage{ @@ -534,6 +536,17 @@ func (s *UtxoSweeper) collector(blockEpochs <-chan *chainntnfs.BlockEpoch) { log.Debugf("Already pending input %v received", outpoint) + // Before updating the input details, check if + // an exclusive group was set, and if so, assume + // this input as finalized and remove all other + // inputs belonging to the same exclusive group. + var prevExclGroup *uint64 + if pendInput.params.ExclusiveGroup != nil && + input.params.ExclusiveGroup == nil { + prevExclGroup = new(uint64) + *prevExclGroup = *pendInput.params.ExclusiveGroup + } + // Update input details and sweep parameters. // The re-offered input details may contain a // change to the unconfirmed parent tx info. @@ -545,6 +558,11 @@ func (s *UtxoSweeper) collector(blockEpochs <-chan *chainntnfs.BlockEpoch) { pendInput.listeners = append( pendInput.listeners, input.resultChan, ) + + if prevExclGroup != nil { + s.removeExclusiveGroup(*prevExclGroup) + } + continue }