lntest: use nextAvailablePort for fee service
This commit is contained in:
1 file changed
+3
-7
@@ -16,9 +16,6 @@ const (
|
|||||||
// is returned. Requests for higher confirmation targets will fall back
|
// is returned. Requests for higher confirmation targets will fall back
|
||||||
// to this.
|
// to this.
|
||||||
feeServiceTarget = 2
|
feeServiceTarget = 2
|
||||||
|
|
||||||
// feeServicePort is the tcp port on which the service runs.
|
|
||||||
feeServicePort = 16534
|
|
||||||
)
|
)
|
||||||
|
|
||||||
// feeService runs a web service that provides fee estimation information.
|
// 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.
|
// startFeeService spins up a go-routine to serve fee estimates.
|
||||||
func startFeeService() *feeService {
|
func startFeeService() *feeService {
|
||||||
|
port := nextAvailablePort()
|
||||||
f := feeService{
|
f := feeService{
|
||||||
url: fmt.Sprintf(
|
url: fmt.Sprintf("http://localhost:%v/fee-estimates.json", port),
|
||||||
"http://localhost:%v/fee-estimates.json", feeServicePort,
|
|
||||||
),
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Initialize default fee estimate.
|
// Initialize default fee estimate.
|
||||||
f.Fees = map[uint32]uint32{feeServiceTarget: 50000}
|
f.Fees = map[uint32]uint32{feeServiceTarget: 50000}
|
||||||
|
|
||||||
listenAddr := fmt.Sprintf(":%v", feeServicePort)
|
listenAddr := fmt.Sprintf(":%v", port)
|
||||||
f.srv = &http.Server{
|
f.srv = &http.Server{
|
||||||
Addr: listenAddr,
|
Addr: listenAddr,
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in new issue
Block a user