Fix PoW to be specifically uint64 as it is a float64 value that is being passed

This commit is contained in:
kdeme 2019-12-17 16:53:39 +01:00
parent abbeeb71b7
commit a514db1427
No known key found for this signature in database
GPG Key ID: 4E8DD21420AF43F5
2 changed files with 8 additions and 8 deletions

View File

@ -153,7 +153,7 @@ p2pProtocol Waku(version = wakuVersion,
wakuPeer = peer.state
let m = await peer.status(wakuVersion,
cast[uint](wakuNet.config.powRequirement),
cast[uint64](wakuNet.config.powRequirement),
@(wakuNet.config.bloom),
wakuNet.config.isLightNode,
wakuNet.config.wakuMode,
@ -206,7 +206,7 @@ p2pProtocol Waku(version = wakuVersion,
handshake:
proc status(peer: Peer,
protocolVersion: uint,
powConverted: uint,
powConverted: uint64,
bloom: Bytes,
isLightNode: bool,
wakuMode: WakuMode,
@ -251,7 +251,7 @@ p2pProtocol Waku(version = wakuVersion,
# notify filters of this message
peer.networkState.filters.notify(msg)
proc powRequirement(peer: Peer, value: uint) =
proc powRequirement(peer: Peer, value: uint64) =
if not peer.state.initialized:
warn "Handshake not completed yet, discarding powRequirement"
return
@ -479,7 +479,7 @@ proc setPowRequirement*(node: EthereumNode, powReq: float64) {.async.} =
node.protocolState(Waku).config.powRequirement = powReq
var futures: seq[Future[void]] = @[]
for peer in node.peers(Waku):
futures.add(peer.powRequirement(cast[uint](powReq)))
futures.add(peer.powRequirement(cast[uint64](powReq)))
# Exceptions from sendMsg will not be raised
await allFutures(futures)

View File

@ -116,7 +116,7 @@ p2pProtocol Whisper(version = whisperVersion,
whisperPeer = peer.state
let m = await peer.status(whisperVersion,
cast[uint](whisperNet.config.powRequirement),
cast[uint64](whisperNet.config.powRequirement),
@(whisperNet.config.bloom),
whisperNet.config.isLightNode,
timeout = chronos.milliseconds(500))
@ -154,7 +154,7 @@ p2pProtocol Whisper(version = whisperVersion,
handshake:
proc status(peer: Peer,
protocolVersion: uint,
powConverted: uint,
powConverted: uint64,
bloom: Bytes,
isLightNode: bool)
@ -197,7 +197,7 @@ p2pProtocol Whisper(version = whisperVersion,
# notify filters of this message
peer.networkState.filters.notify(msg)
proc powRequirement(peer: Peer, value: uint) =
proc powRequirement(peer: Peer, value: uint64) =
if not peer.state.initialized:
warn "Handshake not completed yet, discarding powRequirement"
return
@ -405,7 +405,7 @@ proc setPowRequirement*(node: EthereumNode, powReq: float64) {.async.} =
node.protocolState(Whisper).config.powRequirement = powReq
var futures: seq[Future[void]] = @[]
for peer in node.peers(Whisper):
futures.add(peer.powRequirement(cast[uint](powReq)))
futures.add(peer.powRequirement(cast[uint64](powReq)))
# Exceptions from sendMsg will not be raised
await allFutures(futures)