Skip to content

Commit

Permalink
loop: fix cost migration for pending swaps
Browse files Browse the repository at this point in the history
  • Loading branch information
bhandras committed Jun 4, 2024
1 parent 28c09be commit 9cacd8e
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion cost_migration.go
Original file line number Diff line number Diff line change
Expand Up @@ -150,11 +150,21 @@ func MigrateLoopOutCosts(ctx context.Context, lnd lndclient.LndServices,
// costs in the database.
updatedCosts := make(map[lntypes.Hash]loopdb.SwapCost)
for _, loopOutSwap := range loopOutSwaps {
if loopOutSwap.State().State.IsPending() {
continue
}

cost, err := CalculateLoopOutCost(
lnd.ChainParams, loopOutSwap, paymentFees,
)
if err != nil {
return err
// We don't want to fail loopd because of any old swap
// that we're unable to calculate the cost for. We'll
// warn though so that we can investigate further.
log.Warnf("Unable to calculate cost for swap %v: %v",
loopOutSwap.Hash, err)

continue
}

_, ok := updatedCosts[loopOutSwap.Hash]
Expand Down

0 comments on commit 9cacd8e

Please sign in to comment.