mirror of https://github.com/status-im/nim-eth.git
Quick fix for overflow on 32bit systems
This commit is contained in:
parent
a6be6426ab
commit
c4b25ba708
|
@ -175,9 +175,8 @@ proc updateRechargingParams(peer: LesPeer, network: LesNetwork) =
|
||||||
peer.reqCostGradient = rechargingScale / network.reqCount
|
peer.reqCostGradient = rechargingScale / network.reqCount
|
||||||
|
|
||||||
if peer.isRecharging:
|
if peer.isRecharging:
|
||||||
peer.reqCostGradient = (network.rechargingRate * peer.rechargingPower /
|
peer.reqCostGradient = (network.rechargingRate * (peer.rechargingPower /
|
||||||
network.totalRechargingPower )
|
network.totalRechargingPower).int64).int
|
||||||
|
|
||||||
peer.rechargingEndsAt = peer.lastRechargeTime +
|
peer.rechargingEndsAt = peer.lastRechargeTime +
|
||||||
LesTime(peer.reqCostVal * rechargingScale /
|
LesTime(peer.reqCostVal * rechargingScale /
|
||||||
-peer.reqCostGradient )
|
-peer.reqCostGradient )
|
||||||
|
@ -263,8 +262,8 @@ proc delistFromFlowControl*(network: LesNetwork, peer: LesPeer) =
|
||||||
proc initFlowControl*(network: LesNetwork, les: ProtocolInfo,
|
proc initFlowControl*(network: LesNetwork, les: ProtocolInfo,
|
||||||
maxReqCount, maxReqCostSum, reqCostTarget: int,
|
maxReqCount, maxReqCostSum, reqCostTarget: int,
|
||||||
db: AbstractChainDB = nil) =
|
db: AbstractChainDB = nil) =
|
||||||
network.rechargingRate = (rechargingScale * rechargingScale) /
|
network.rechargingRate = rechargingScale * (rechargingScale /
|
||||||
(100 * rechargingScale / reqCostTarget - rechargingScale)
|
(100 * rechargingScale / reqCostTarget - rechargingScale))
|
||||||
network.maxReqCount = maxReqCount
|
network.maxReqCount = maxReqCount
|
||||||
network.maxReqCostSum = maxReqCostSum
|
network.maxReqCostSum = maxReqCostSum
|
||||||
|
|
||||||
|
|
|
@ -85,7 +85,7 @@ type
|
||||||
reqCount*, maxReqCount*: int
|
reqCount*, maxReqCount*: int
|
||||||
sumWeigth*: int
|
sumWeigth*: int
|
||||||
|
|
||||||
rechargingRate*: int
|
rechargingRate*: int64
|
||||||
totalRechargedUnits*: int
|
totalRechargedUnits*: int
|
||||||
totalRechargingPower*: int
|
totalRechargingPower*: int
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue