mirror of
https://github.com/status-im/nimbus-eth1.git
synced 2025-01-13 13:55:45 +00:00
Cosmetic improvements
This commit is contained in:
parent
da1adb37e6
commit
d23a33a80c
@ -44,7 +44,7 @@ proc setupWakuRPC*(node: EthereumNode, keys: KeyStorage, rpcsrv: RpcServer) =
|
|||||||
## Returns true on success and an error on failure.
|
## Returns true on success and an error on failure.
|
||||||
# Note: `setPowRequirement` does not raise on failures of sending the update
|
# Note: `setPowRequirement` does not raise on failures of sending the update
|
||||||
# to the peers. Hence in theory this should not causes errors.
|
# to the peers. Hence in theory this should not causes errors.
|
||||||
waitFor node.setPowRequirement(pow)
|
await node.setPowRequirement(pow)
|
||||||
result = true
|
result = true
|
||||||
|
|
||||||
# TODO: change string in to ENodeStr with extra checks
|
# TODO: change string in to ENodeStr with extra checks
|
||||||
@ -80,8 +80,7 @@ proc setupWakuRPC*(node: EthereumNode, keys: KeyStorage, rpcsrv: RpcServer) =
|
|||||||
## Returns key identifier on success and an error on failure.
|
## Returns key identifier on success and an error on failure.
|
||||||
result = generateRandomID().Identifier
|
result = generateRandomID().Identifier
|
||||||
|
|
||||||
keys.asymKeys.add(result.string, KeyPair(seckey: key,
|
keys.asymKeys.add(result.string, key.toKeyPair)
|
||||||
pubkey: key.getPublicKey()))
|
|
||||||
|
|
||||||
rpcsrv.rpc("waku_deleteKeyPair") do(id: Identifier) -> bool:
|
rpcsrv.rpc("waku_deleteKeyPair") do(id: Identifier) -> bool:
|
||||||
## Deletes the specifies key if it exists.
|
## Deletes the specifies key if it exists.
|
||||||
@ -272,14 +271,14 @@ proc setupWakuRPC*(node: EthereumNode, keys: KeyStorage, rpcsrv: RpcServer) =
|
|||||||
if config.wakuMode == WakuChan:
|
if config.wakuMode == WakuChan:
|
||||||
try:
|
try:
|
||||||
# TODO: an addTopics call would probably be more useful
|
# TODO: an addTopics call would probably be more useful
|
||||||
let result = waitFor node.setTopics(config.topics.concat(filter.topics))
|
let result = await node.setTopics(config.topics.concat(filter.topics))
|
||||||
if not result:
|
if not result:
|
||||||
raise newException(ValueError, "Too many topics")
|
raise newException(ValueError, "Too many topics")
|
||||||
except CatchableError:
|
except CatchableError:
|
||||||
trace "setTopics error occured"
|
trace "setTopics error occured"
|
||||||
elif config.isLightNode:
|
elif config.isLightNode:
|
||||||
try:
|
try:
|
||||||
waitFor node.setBloomFilter(node.filtersToBloom())
|
await node.setBloomFilter(node.filtersToBloom())
|
||||||
except CatchableError:
|
except CatchableError:
|
||||||
trace "setBloomFilter error occured"
|
trace "setBloomFilter error occured"
|
||||||
|
|
||||||
@ -302,22 +301,18 @@ proc setupWakuRPC*(node: EthereumNode, keys: KeyStorage, rpcsrv: RpcServer) =
|
|||||||
## Returns array of messages on success and an error on failure.
|
## Returns array of messages on success and an error on failure.
|
||||||
let messages = node.getFilterMessages(id.string)
|
let messages = node.getFilterMessages(id.string)
|
||||||
for msg in messages:
|
for msg in messages:
|
||||||
var filterMsg: WhisperFilterMessage
|
result.add WhisperFilterMessage(
|
||||||
|
sig: msg.decoded.src,
|
||||||
filterMsg.sig = msg.decoded.src
|
recipientPublicKey: msg.dst,
|
||||||
filterMsg.recipientPublicKey = msg.dst
|
ttl: msg.ttl,
|
||||||
filterMsg.ttl = msg.ttl
|
topic: msg.topic,
|
||||||
filterMsg.topic = msg.topic
|
timestamp: msg.timestamp,
|
||||||
filterMsg.timestamp = msg.timestamp
|
payload: msg.decoded.payload,
|
||||||
filterMsg.payload = msg.decoded.payload
|
|
||||||
# Note: whisper_protocol padding is an Option as there is the
|
# Note: whisper_protocol padding is an Option as there is the
|
||||||
# possibility of 0 padding in case of custom padding.
|
# possibility of 0 padding in case of custom padding.
|
||||||
if msg.decoded.padding.isSome():
|
padding: msg.decoded.padding.get(@[]),
|
||||||
filterMsg.padding = msg.decoded.padding.get()
|
pow: msg.pow,
|
||||||
filterMsg.pow = msg.pow
|
hash: msg.hash)
|
||||||
filterMsg.hash = msg.hash
|
|
||||||
|
|
||||||
result.add(filterMsg)
|
|
||||||
|
|
||||||
rpcsrv.rpc("waku_post") do(message: WhisperPostMessage) -> bool:
|
rpcsrv.rpc("waku_post") do(message: WhisperPostMessage) -> bool:
|
||||||
## Creates a whisper message and injects it into the network for
|
## Creates a whisper message and injects it into the network for
|
||||||
|
@ -45,7 +45,7 @@ proc setupWhisperRPC*(node: EthereumNode, keys: KeyStorage, rpcsrv: RpcServer) =
|
|||||||
## Returns true on success and an error on failure.
|
## Returns true on success and an error on failure.
|
||||||
# Note: `setPowRequirement` does not raise on failures of sending the update
|
# Note: `setPowRequirement` does not raise on failures of sending the update
|
||||||
# to the peers. Hence in theory this should not causes errors.
|
# to the peers. Hence in theory this should not causes errors.
|
||||||
waitFor node.setPowRequirement(pow)
|
await node.setPowRequirement(pow)
|
||||||
result = true
|
result = true
|
||||||
|
|
||||||
# TODO: change string in to ENodeStr with extra checks
|
# TODO: change string in to ENodeStr with extra checks
|
||||||
|
2
vendor/nim-eth
vendored
2
vendor/nim-eth
vendored
@ -1 +1 @@
|
|||||||
Subproject commit b7ebf8ed54c14884a63f185de1f38a25bc8fbcbc
|
Subproject commit fc327718fbbbdf9a96827b6702d70f3a6e756425
|
2
vendor/nim-json-rpc
vendored
2
vendor/nim-json-rpc
vendored
@ -1 +1 @@
|
|||||||
Subproject commit fc0665f88a4f24e9f51fe059ad4e943f3eed927e
|
Subproject commit 9b401994a16640892e3e643c52fa4ff00f4b9b3e
|
Loading…
x
Reference in New Issue
Block a user