les: fixed tests

This commit is contained in:
Zsolt Felfoldi 2019-01-22 11:35:32 +01:00
parent 9a41698360
commit 645b900fb0
2 changed files with 13 additions and 3 deletions

View file

@ -381,9 +381,14 @@ func (pm *ProtocolManager) handleMsg(p *peer) error {
if reply != nil {
replySize = reply.size()
}
realCost := pm.server.costTracker.realCost(servingTime, msg.Size, replySize)
var realCost uint64
if pm.server.costTracker != nil {
realCost = pm.server.costTracker.realCost(servingTime, msg.Size, replySize)
pm.server.costTracker.updateStats(msg.Code, amount, servingTime, realCost)
} else {
realCost = maxCost
}
bv := p.fcClient.RequestProcessed(reqID, responseCount, maxCost, realCost)
pm.server.costTracker.updateStats(msg.Code, amount, servingTime, realCost)
if reply != nil {
p.queueSend(func() {
if err := reply.send(bv); err != nil {

View file

@ -519,7 +519,12 @@ func (p *peer) Handshake(td *big.Int, head common.Hash, headNum uint64, genesis
}
send = send.add("flowControl/BL", server.defParams.BufLimit)
send = send.add("flowControl/MRR", server.defParams.MinRecharge)
costList := server.costTracker.makeCostList()
var costList RequestCostList
if server.costTracker != nil {
costList = server.costTracker.makeCostList()
} else {
costList = testRCL()
}
send = send.add("flowControl/MRC", costList)
p.fcCosts = costList.decode()
p.fcParams = server.defParams