diff --git a/lntest/harness.go b/lntest/harness.go index 91f2e188f..9b3e9b3fe 100644 --- a/lntest/harness.go +++ b/lntest/harness.go @@ -186,11 +186,6 @@ func (h *HarnessTest) SetupStandbyNodes() { h.Alice = h.NewNode("Alice", lndArgs) h.Bob = h.NewNode("Bob", lndArgs) - // First, make a connection between the two nodes. This will wait until - // both nodes are fully started since the Connect RPC is guarded behind - // the server.Started() flag that waits for all subsystems to be ready. - h.ConnectNodes(h.Alice, h.Bob) - addrReq := &lnrpc.NewAddressRequest{ Type: lnrpc.AddressType_WITNESS_PUBKEY_HASH, } diff --git a/lntest/harness_assertion.go b/lntest/harness_assertion.go index a58f292e6..7f6a6d866 100644 --- a/lntest/harness_assertion.go +++ b/lntest/harness_assertion.go @@ -146,6 +146,12 @@ func (h *HarnessTest) EnsureConnected(a, b *node.HarnessNode) { // connected to the peer. errConnectionRequested := "connection request in progress" + // windowsErr is an error we've seen from windows build where + // connecting to an already connected node gives such error from the + // receiver side. + windowsErr := "An established connection was aborted by the software " + + "in your host machine." + tryConnect := func(a, b *node.HarnessNode) error { bInfo := b.RPC.GetInfo() @@ -166,17 +172,21 @@ func (h *HarnessTest) EnsureConnected(a, b *node.HarnessNode) { return nil } - // If the connection is in process, we return no error. - if strings.Contains(err.Error(), errConnectionRequested) { - return nil - } - // If the two are already connected, we return early with no // error. if strings.Contains(err.Error(), "already connected to peer") { return nil } + // Otherwise we log the error to console. + h.Logf("EnsureConnected %s=>%s got err: %v", a.Name(), + b.Name(), err) + + // If the connection is in process, we return no error. + if strings.Contains(err.Error(), errConnectionRequested) { + return nil + } + // We may get connection refused error if we happens to be in // the middle of a previous node disconnection, e.g., a restart // from one of the nodes. @@ -184,6 +194,16 @@ func (h *HarnessTest) EnsureConnected(a, b *node.HarnessNode) { return nil } + // Check for windows error. If Alice connects to Bob, Alice + // will throw "i/o timeout" and Bob will give windowsErr. + if strings.Contains(err.Error(), windowsErr) { + return nil + } + + if strings.Contains(err.Error(), "i/o timeout") { + return nil + } + return err }