diff --git a/sweep/fee_bumper.go b/sweep/fee_bumper.go index 38983f8fe..67a3663df 100644 --- a/sweep/fee_bumper.go +++ b/sweep/fee_bumper.go @@ -1170,6 +1170,19 @@ func (t *TxPublisher) handleUnknownSpent(r *monitorRecord) { "bumper, failing it now:\n%v", r.requestID, inputTypeSummary(r.req.Inputs)) + // Create a result that will be sent to the resultChan which is listened + // by the caller. + result := t.createUnknownSpentBumpResult(r) + + // Notify the sweeper about this result in the end. + t.handleResult(result) +} + +// createUnknownSpentBumpResult creates and returns a BumpResult given the +// monitored record has unknown spends. +func (t *TxPublisher) createUnknownSpentBumpResult( + r *monitorRecord) *BumpResult { + // Create a result that will be sent to the resultChan which is listened // by the caller. result := &BumpResult{ @@ -1208,10 +1221,7 @@ func (t *TxPublisher) handleUnknownSpent(r *monitorRecord) { result.Event = TxFatal result.Err = err - // Notify the sweeper about this result in the end. - t.handleResult(result) - - return + return result } feeFunc = f @@ -1234,8 +1244,7 @@ func (t *TxPublisher) handleUnknownSpent(r *monitorRecord) { // Attach the new fee rate to be used for the next sweeping attempt. result.FeeRate = feeFunc.FeeRate() - // Notify the sweeper about this result in the end. - t.handleResult(result) + return result } // createAndPublishTx creates a new tx with a higher fee rate and publishes it