mirror of
https://github.com/lightningnetwork/lnd.git
synced 2025-06-05 20:49:48 +02:00
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:
parent
db8319d70b
commit
f614e7aed9
@ -1170,6 +1170,19 @@ func (t *TxPublisher) handleUnknownSpent(r *monitorRecord) {
|
|||||||
"bumper, failing it now:\n%v", r.requestID,
|
"bumper, failing it now:\n%v", r.requestID,
|
||||||
inputTypeSummary(r.req.Inputs))
|
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
|
// Create a result that will be sent to the resultChan which is listened
|
||||||
// by the caller.
|
// by the caller.
|
||||||
result := &BumpResult{
|
result := &BumpResult{
|
||||||
@ -1208,10 +1221,7 @@ func (t *TxPublisher) handleUnknownSpent(r *monitorRecord) {
|
|||||||
result.Event = TxFatal
|
result.Event = TxFatal
|
||||||
result.Err = err
|
result.Err = err
|
||||||
|
|
||||||
// Notify the sweeper about this result in the end.
|
return result
|
||||||
t.handleResult(result)
|
|
||||||
|
|
||||||
return
|
|
||||||
}
|
}
|
||||||
|
|
||||||
feeFunc = f
|
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.
|
// Attach the new fee rate to be used for the next sweeping attempt.
|
||||||
result.FeeRate = feeFunc.FeeRate()
|
result.FeeRate = feeFunc.FeeRate()
|
||||||
|
|
||||||
// Notify the sweeper about this result in the end.
|
return result
|
||||||
t.handleResult(result)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// createAndPublishTx creates a new tx with a higher fee rate and publishes it
|
// createAndPublishTx creates a new tx with a higher fee rate and publishes it
|
||||||
|
Loading…
x
Reference in New Issue
Block a user