From 5c04449dfdf53c4ef31dc4f58312172d4f469b7f Mon Sep 17 00:00:00 2001 From: Oliver Gugger Date: Wed, 4 Nov 2020 11:03:26 +0100 Subject: [PATCH] lntest: use nextAvailablePort for fee service --- lntest/fee_service.go | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/lntest/fee_service.go b/lntest/fee_service.go index 68e7d435..d71dae7d 100644 --- a/lntest/fee_service.go +++ b/lntest/fee_service.go @@ -16,9 +16,6 @@ const ( // is returned. Requests for higher confirmation targets will fall back // to this. feeServiceTarget = 2 - - // feeServicePort is the tcp port on which the service runs. - feeServicePort = 16534 ) // feeService runs a web service that provides fee estimation information. @@ -40,16 +37,15 @@ type feeEstimates struct { // startFeeService spins up a go-routine to serve fee estimates. func startFeeService() *feeService { + port := nextAvailablePort() f := feeService{ - url: fmt.Sprintf( - "http://localhost:%v/fee-estimates.json", feeServicePort, - ), + url: fmt.Sprintf("http://localhost:%v/fee-estimates.json", port), } // Initialize default fee estimate. f.Fees = map[uint32]uint32{feeServiceTarget: 50000} - listenAddr := fmt.Sprintf(":%v", feeServicePort) + listenAddr := fmt.Sprintf(":%v", port) f.srv = &http.Server{ Addr: listenAddr, }