les: move server pool to les/vflux/client (#22377)

* les: move serverPool to les/vflux/client

* les: add metrics

* les: moved ValueTracker inside ServerPool

* les: protect against node registration before server pool is started

* les/vflux/client: fixed tests

* les: make peer registration safe
This commit is contained in:
Felföldi Zsolt
2021-02-25 21:08:34 +01:00
committed by GitHub
parent de9465f991
commit dc109cce26
9 changed files with 206 additions and 198 deletions

View File

@@ -64,7 +64,7 @@ func TestValueTracker(t *testing.T) {
for j := range costList {
costList[j] = uint64(baseCost * relPrices[j])
}
vt.UpdateCosts(nodes[i], costList)
nodes[i].UpdateCosts(costList)
}
for i := range nodes {
nodes[i] = vt.Register(enode.ID{byte(i)})
@@ -77,7 +77,7 @@ func TestValueTracker(t *testing.T) {
node := rand.Intn(testNodeCount)
respTime := time.Duration((rand.Float64() + 1) * float64(time.Second) * float64(node+1) / testNodeCount)
totalAmount[reqType] += uint64(reqAmount)
vt.Served(nodes[node], []ServedRequest{{uint32(reqType), uint32(reqAmount)}}, respTime)
nodes[node].Served([]ServedRequest{{uint32(reqType), uint32(reqAmount)}}, respTime)
clock.Run(time.Second)
}
} else {