mirror of
https://github.com/lightningnetwork/lnd.git
synced 2025-09-08 23:01:53 +02:00
lntest: avoid global ServeMux
Using the default, global ServeMux prevents the same process from calling `lntest.NewNetworkHarness` multiple times, because we get a panic when registering HTTP routes. Instead, we use the ServeMux beloning to the fee service struct.
This commit is contained in:
@@ -46,11 +46,13 @@ func startFeeService() *feeService {
|
||||
f.Fees = map[uint32]uint32{feeServiceTarget: 50000}
|
||||
|
||||
listenAddr := fmt.Sprintf(":%v", port)
|
||||
f.srv = &http.Server{
|
||||
Addr: listenAddr,
|
||||
}
|
||||
mux := http.NewServeMux()
|
||||
mux.HandleFunc("/fee-estimates.json", f.handleRequest)
|
||||
|
||||
http.HandleFunc("/fee-estimates.json", f.handleRequest)
|
||||
f.srv = &http.Server{
|
||||
Addr: listenAddr,
|
||||
Handler: mux,
|
||||
}
|
||||
|
||||
f.wg.Add(1)
|
||||
go func() {
|
||||
|
Reference in New Issue
Block a user