mirror of
https://github.com/lightninglabs/loop.git
synced 2026-08-13 12:33:03 +02:00
loop: fix cost migration for pending swaps
This commit is contained in:
parent
28c09bec68
commit
9cacd8eb75
1 changed files with 11 additions and 1 deletions
|
|
@ -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]
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue