mirror of
https://github.com/lightninglabs/loop.git
synced 2026-08-13 12:33:03 +02:00
sweepbatcher: store batch status before monitoring
If monitorConfirmations fails, we still want to persist the state to DB.
This commit is contained in:
parent
fa1bc48a68
commit
7edbfeadd8
1 changed files with 9 additions and 6 deletions
|
|
@ -2099,16 +2099,19 @@ func (b *batch) handleSpend(ctx context.Context, spendTx *wire.MsgTx) error {
|
|||
"purged swaps: %v, purged groups: %v", confirmedSweeps,
|
||||
purgedSweeps, purgedSwaps, len(purgeList))
|
||||
|
||||
err = b.monitorConfirmations(ctx)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
// We are no longer able to accept new sweeps, so we mark the batch as
|
||||
// closed and persist on storage.
|
||||
b.state = Closed
|
||||
|
||||
return b.persist(ctx)
|
||||
if err = b.persist(ctx); err != nil {
|
||||
return fmt.Errorf("saving batch failed: %w", err)
|
||||
}
|
||||
|
||||
if err = b.monitorConfirmations(ctx); err != nil {
|
||||
return fmt.Errorf("monitorConfirmations failed: %w", err)
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// handleConf handles a confirmation notification. This is the final step of the
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue