mirror of
https://github.com/lightningnetwork/lnd.git
synced 2025-06-28 09:45:25 +02:00
itest: fix close of closed channel panic
This commit is contained in:
parent
1774934666
commit
c89637a4e2
@ -1599,6 +1599,15 @@ func (hn *HarnessNode) WaitForChannelPolicyUpdate(ctx context.Context,
|
|||||||
select {
|
select {
|
||||||
// Send a watch request every second.
|
// Send a watch request every second.
|
||||||
case <-ticker.C:
|
case <-ticker.C:
|
||||||
|
// Did the event can close in the meantime? We want to
|
||||||
|
// avoid a "close of closed channel" panic since we're
|
||||||
|
// re-using the same event chan for multiple requests.
|
||||||
|
select {
|
||||||
|
case <-eventChan:
|
||||||
|
return nil
|
||||||
|
default:
|
||||||
|
}
|
||||||
|
|
||||||
hn.chanWatchRequests <- &chanWatchRequest{
|
hn.chanWatchRequests <- &chanWatchRequest{
|
||||||
chanPoint: op,
|
chanPoint: op,
|
||||||
eventChan: eventChan,
|
eventChan: eventChan,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user