diff --git a/client.go b/client.go index ed73349..cad224c 100644 --- a/client.go +++ b/client.go @@ -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) } } diff --git a/loopin.go b/loopin.go index 275565b..e22196d 100644 --- a/loopin.go +++ b/loopin.go @@ -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 }