diff --git a/network/gateway/hostPool.go b/network/gateway/hostPool.go index ba6cd338a2c2c74f8c708a9dce930bdefb35c1c2..71ae48456fddbc9541155d97761c7620a156169c 100644 --- a/network/gateway/hostPool.go +++ b/network/gateway/hostPool.go @@ -91,21 +91,14 @@ func newHostPool(poolParams PoolParams, rng io.Reader, ndf *ndf.NetworkDefinitio addGatewayChan: addGateway, } - // Propagate the NDF and return + // Propagate the NDF err := result.updateConns() if err != nil { return nil, err } - // Build the initial HostPool - err = result.pruneHostPool() - if err != nil { - return nil, err - } - - // Convert the NDF into an empty map object in order to allow updateConns - result.ndfMap, err = convertNdfToMap(nil) - return result, err + // Build the initial HostPool and return + return result, result.pruneHostPool() } // UpdateNdf Mutates internal ndf to the given ndf diff --git a/network/gateway/hostpool_test.go b/network/gateway/hostpool_test.go index a1feb5a37880e313e68ac465a66fd427b5875b1a..4fd01a3f40712b619378202062747975dd444038 100644 --- a/network/gateway/hostpool_test.go +++ b/network/gateway/hostpool_test.go @@ -115,7 +115,7 @@ func TestHostPool_ManageHostPool(t *testing.T) { testPool.UpdateNdf(newNdf) - time.Sleep(2 * time.Second) + time.Sleep(testPool.poolParams.PruneInterval + 1*time.Second) // Check that old gateways are not in pool for _, ndfGw := range testNdf.Gateways {