sweep: add createUnknownSpentBumpResult

A minor refactor to break the method `handleUnknownSpent` into two
steps, which prepares the following commit where we start handling
missing inputs.
This commit is contained in:
yyforyongyu 2025-02-12 19:10:25 +08:00
parent db8319d70b
commit f614e7aed9
No known key found for this signature in database
GPG Key ID: 9BCD95C4FF296868

View File

@ -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