test: eliminate panics on RPC call errors
This commit is contained in:
parent
80d38d6bbc
commit
2ed510d1d9
@ -602,10 +602,12 @@ func (n *networkHarness) OpenChannel(ctx context.Context,
|
|||||||
resp, err := respStream.Recv()
|
resp, err := respStream.Recv()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
errChan <- err
|
errChan <- err
|
||||||
|
return
|
||||||
}
|
}
|
||||||
if _, ok := resp.Update.(*lnrpc.OpenStatusUpdate_ChanPending); !ok {
|
if _, ok := resp.Update.(*lnrpc.OpenStatusUpdate_ChanPending); !ok {
|
||||||
errChan <- fmt.Errorf("expected channel pending update, "+
|
errChan <- fmt.Errorf("expected channel pending update, "+
|
||||||
"instead got %v", resp)
|
"instead got %v", resp)
|
||||||
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
close(chanOpen)
|
close(chanOpen)
|
||||||
@ -635,11 +637,13 @@ func (n *networkHarness) WaitForChannelOpen(ctx context.Context,
|
|||||||
resp, err := openChanStream.Recv()
|
resp, err := openChanStream.Recv()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
errChan <- fmt.Errorf("unable to read rpc resp: %v", err)
|
errChan <- fmt.Errorf("unable to read rpc resp: %v", err)
|
||||||
|
return
|
||||||
}
|
}
|
||||||
fundingResp, ok := resp.Update.(*lnrpc.OpenStatusUpdate_ChanOpen)
|
fundingResp, ok := resp.Update.(*lnrpc.OpenStatusUpdate_ChanOpen)
|
||||||
if !ok {
|
if !ok {
|
||||||
errChan <- fmt.Errorf("expected channel open update, "+
|
errChan <- fmt.Errorf("expected channel open update, "+
|
||||||
"instead got %v", resp)
|
"instead got %v", resp)
|
||||||
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
respChan <- fundingResp.ChanOpen.ChannelPoint
|
respChan <- fundingResp.ChanOpen.ChannelPoint
|
||||||
|
Loading…
Reference in New Issue
Block a user