Skip to content

Commit 9cacd8e

Browse files
committed
loop: fix cost migration for pending swaps
1 parent 28c09be commit 9cacd8e

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

cost_migration.go

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -150,11 +150,21 @@ func MigrateLoopOutCosts(ctx context.Context, lnd lndclient.LndServices,
150150
// costs in the database.
151151
updatedCosts := make(map[lntypes.Hash]loopdb.SwapCost)
152152
for _, loopOutSwap := range loopOutSwaps {
153+
if loopOutSwap.State().State.IsPending() {
154+
continue
155+
}
156+
153157
cost, err := CalculateLoopOutCost(
154158
lnd.ChainParams, loopOutSwap, paymentFees,
155159
)
156160
if err != nil {
157-
return err
161+
// We don't want to fail loopd because of any old swap
162+
// that we're unable to calculate the cost for. We'll
163+
// warn though so that we can investigate further.
164+
log.Warnf("Unable to calculate cost for swap %v: %v",
165+
loopOutSwap.Hash, err)
166+
167+
continue
158168
}
159169

160170
_, ok := updatedCosts[loopOutSwap.Hash]

0 commit comments

Comments
 (0)