From 2cc28baa847178a90099fa2a242de1323a157cdb Mon Sep 17 00:00:00 2001
From: Oliver Gugger <gugger@gmail.com>
Date: Fri, 15 Mar 2024 12:54:33 +0100
Subject: [PATCH] chainntnfs: re-try miner connection more often

Make sure we wait for the initial connection long enough.
---
 chainntnfs/test_utils.go | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/chainntnfs/test_utils.go b/chainntnfs/test_utils.go
index 73bd2cf69..7c4e360d4 100644
--- a/chainntnfs/test_utils.go
+++ b/chainntnfs/test_utils.go
@@ -181,6 +181,14 @@ func NewMiner(t *testing.T, netParams *chaincfg.Params, extraArgs []string,
 		require.NoError(t, node.TearDown())
 	})
 
+	// We want to overwrite some of the connection settings to make the
+	// tests more robust. We might need to restart the backend while there
+	// are already blocks present, which will take a bit longer than the
+	// 1 second the default settings amount to. Doubling both values will
+	// give us retries up to 4 seconds.
+	node.MaxConnRetries = rpctest.DefaultMaxConnectionRetries * 2
+	node.ConnectionRetryTimeout = rpctest.DefaultConnectionRetryTimeout * 2
+
 	if err := node.SetUp(createChain, spendableOutputs); err != nil {
 		t.Fatalf("unable to set up backend node: %v", err)
 	}