lntest: use nextAvailablePort for fee service

This commit is contained in:
Oliver Gugger 2020-11-04 11:03:26 +01:00
parent a50d337e42
commit 5c04449dfd
No known key found for this signature in database
GPG Key ID: 8E4256593F177720

@ -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,
}