From b094a1c1c48a3e5f95d6547bad0302c2fce45b76 Mon Sep 17 00:00:00 2001 From: Oliver Gugger Date: Wed, 24 Jun 2020 18:08:21 +0200 Subject: [PATCH] rpcserver: wait between peer connects --- rpcserver.go | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/rpcserver.go b/rpcserver.go index 4b6a78a..d2657e4 100644 --- a/rpcserver.go +++ b/rpcserver.go @@ -283,6 +283,19 @@ func connectToMatchedTrader(lndClient lnrpc.LightningClient, continue } + + // Don't spam peer connections. This can lead to race errors in + // the itest when we try to connect to the same node in very + // short intervals. + // + // TODO(guggero): Fix this problem in lnd and also try to + // de-duplicate peers and their addresses to reduce connection + // tries. + time.Sleep(200 * time.Millisecond) + + // We connected successfully, not need to try any of the other + // addresses. + break } // Since we specified perm, the error is async, and not fully