From 19873f721f4ac1c544c2f9eda0075101b6e502e6 Mon Sep 17 00:00:00 2001 From: Matheus Degiovani Date: Mon, 9 Mar 2020 11:10:14 -0300 Subject: [PATCH] lntest: more descriptive errors for CloseChannel This improves the error reporting for the harness' CloseChannel so that the exact step where closure fails can be better indicated. This is to help debug some flaky failures in the CI. --- lntest/harness.go | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/lntest/harness.go b/lntest/harness.go index eb75d0fe3..89a4141ba 100644 --- a/lntest/harness.go +++ b/lntest/harness.go @@ -1128,7 +1128,8 @@ func (n *NetworkHarness) CloseChannel(ctx context.Context, // within the network. closeResp, err := closeRespStream.Recv() if err != nil { - errChan <- err + errChan <- fmt.Errorf("unable to recv() from close "+ + "stream: %v", err) return } pendingClose, ok := closeResp.Update.(*lnrpc.CloseStatusUpdate_ClosePending) @@ -1140,11 +1141,13 @@ func (n *NetworkHarness) CloseChannel(ctx context.Context, closeTxid, err := chainhash.NewHash(pendingClose.ClosePending.Txid) if err != nil { - errChan <- err + errChan <- fmt.Errorf("unable to decode closeTxid: "+ + "%v", err) return } if err := n.WaitForTxBroadcast(ctx, *closeTxid); err != nil { - errChan <- err + errChan <- fmt.Errorf("error while waiting for "+ + "broadcast tx: %v", err) return } fin <- closeTxid @@ -1153,9 +1156,6 @@ func (n *NetworkHarness) CloseChannel(ctx context.Context, // Wait until either the deadline for the context expires, an error // occurs, or the channel close update is received. select { - case <-ctx.Done(): - return nil, nil, fmt.Errorf("timeout reached before channel close " + - "initiated") case err := <-errChan: return nil, nil, err case closeTxid := <-fin: