Merge pull request #152 from status-im/pow-uint32-issue

Fix PoW to be specifically uint64 as it is a float64 value that is be…
This commit is contained in:
kdeme 2019-12-17 14:54:43 -08:00 committed by GitHub
commit 94f53e6924
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
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)