mirror of
https://github.com/lightningnetwork/lnd.git
synced 2025-09-08 05:08:13 +02:00
sweep: add method markInputFailed
This commit is contained in:
@@ -1421,7 +1421,7 @@ func (s *UtxoSweeper) handleNewInput(input *sweepInputMessage) {
|
||||
)
|
||||
if err != nil {
|
||||
err := fmt.Errorf("wait for spend: %w", err)
|
||||
s.signalResult(pi, Result{Err: err})
|
||||
s.markInputFailed(pi, err)
|
||||
|
||||
return
|
||||
}
|
||||
@@ -1624,6 +1624,21 @@ func (s *UtxoSweeper) markInputsSwept(tx *wire.MsgTx, isOurTx bool) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
// markInputFailed marks the given input as failed and won't be retried. It
|
||||
// will also notify all the subscribers of this input.
|
||||
func (s *UtxoSweeper) markInputFailed(pi *pendingInput, err error) {
|
||||
log.Errorf("Failed to sweep input: %v, error: %v", pi, err)
|
||||
|
||||
pi.state = StateFailed
|
||||
|
||||
// Remove all other inputs in this exclusive group.
|
||||
if pi.params.ExclusiveGroup != nil {
|
||||
s.removeExclusiveGroup(*pi.params.ExclusiveGroup)
|
||||
}
|
||||
|
||||
s.signalResult(pi, Result{Err: err})
|
||||
}
|
||||
|
||||
// updateSweeperInputs updates the sweeper's internal state and returns a map
|
||||
// of inputs to be swept. It will remove the inputs that are in final states,
|
||||
// and returns a map of inputs that have either StateInit or
|
||||
|
Reference in New Issue
Block a user