loopin: restore abandon chan on restart

pull/661/head
Slyghtning 5 months ago
parent 5e91c446b8
commit c0b419346c
No known key found for this signature in database
GPG Key ID: F82D456EA023C9BF

@ -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…
Cancel
Save