mirror of
https://github.com/lightninglabs/loop.git
synced 2026-08-13 12:33:03 +02:00
loopin: restore abandon chan on restart
This commit is contained in:
parent
5e91c446b8
commit
c0b419346c
2 changed files with 10 additions and 0 deletions
|
|
@ -381,6 +381,12 @@ func (s *Client) resumeSwaps(ctx context.Context,
|
|||
continue
|
||||
}
|
||||
|
||||
// Store the swap's abandon channel so that the client can
|
||||
// abandon the swap by providing the swap hash.
|
||||
s.executor.Lock()
|
||||
s.abandonChans[swap.hash] = swap.abandonChan
|
||||
s.executor.Unlock()
|
||||
|
||||
s.executor.initiateSwap(ctx, swap)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -421,6 +421,10 @@ func resumeLoopInSwap(_ context.Context, cfg *swapConfig,
|
|||
swap.cost = lastUpdate.Cost
|
||||
}
|
||||
|
||||
// Upon restoring the swap we also need to assign a new abandon channel
|
||||
// that the client can use to signal that the swap should be abandoned.
|
||||
swap.abandonChan = make(chan struct{}, 1)
|
||||
|
||||
return swap, nil
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue