mirror of
https://github.com/status-im/nimbus-eth1.git
synced 2025-02-04 00:05:22 +00:00
More cosmetic changes
This commit is contained in:
parent
e8ec1706ed
commit
4ec126afaf
@ -80,7 +80,7 @@ proc setupWakuRPC*(node: EthereumNode, keys: KeyStorage, rpcsrv: RpcServer) =
|
||||
## Returns key identifier on success and an error on failure.
|
||||
result = generateRandomID().Identifier
|
||||
|
||||
keys.asymKeys.add(result.string, key.toKeyPair)
|
||||
keys.asymKeys.add(result.string, key.toKeyPair())
|
||||
|
||||
rpcsrv.rpc("waku_deleteKeyPair") do(id: Identifier) -> bool:
|
||||
## Deletes the specifies key if it exists.
|
||||
|
@ -81,8 +81,7 @@ proc setupWhisperRPC*(node: EthereumNode, keys: KeyStorage, rpcsrv: RpcServer) =
|
||||
## Returns key identifier on success and an error on failure.
|
||||
result = generateRandomID().Identifier
|
||||
|
||||
keys.asymKeys.add(result.string, KeyPair(seckey: key,
|
||||
pubkey: key.getPublicKey()))
|
||||
keys.asymKeys.add(result.string, key.toKeyPair())
|
||||
|
||||
rpcsrv.rpc("shh_deleteKeyPair") do(id: Identifier) -> bool:
|
||||
## Deletes the specifies key if it exists.
|
||||
@ -283,22 +282,18 @@ proc setupWhisperRPC*(node: EthereumNode, keys: KeyStorage, rpcsrv: RpcServer) =
|
||||
## Returns array of messages on success and an error on failure.
|
||||
let messages = node.getFilterMessages(id.string)
|
||||
for msg in messages:
|
||||
var filterMsg: WhisperFilterMessage
|
||||
|
||||
filterMsg.sig = msg.decoded.src
|
||||
filterMsg.recipientPublicKey = msg.dst
|
||||
filterMsg.ttl = msg.ttl
|
||||
filterMsg.topic = msg.topic
|
||||
filterMsg.timestamp = msg.timestamp
|
||||
filterMsg.payload = msg.decoded.payload
|
||||
# Note: whisper_protocol padding is an Option as there is the
|
||||
# possibility of 0 padding in case of custom padding.
|
||||
if msg.decoded.padding.isSome():
|
||||
filterMsg.padding = msg.decoded.padding.get()
|
||||
filterMsg.pow = msg.pow
|
||||
filterMsg.hash = msg.hash
|
||||
|
||||
result.add(filterMsg)
|
||||
result.add WhisperFilterMessage(
|
||||
sig: msg.decoded.src,
|
||||
recipientPublicKey: msg.dst,
|
||||
ttl: msg.ttl,
|
||||
topic: msg.topic,
|
||||
timestamp: msg.timestamp,
|
||||
payload: msg.decoded.payload,
|
||||
# Note: whisper_protocol padding is an Option as there is the
|
||||
# possibility of 0 padding in case of custom padding.
|
||||
padding: msg.decoded.padding.get(@[]),
|
||||
pow: msg.pow,
|
||||
hash: msg.hash)
|
||||
|
||||
rpcsrv.rpc("shh_post") do(message: WhisperPostMessage) -> bool:
|
||||
## Creates a whisper message and injects it into the network for
|
||||
|
@ -99,7 +99,8 @@ proc nimbus_start(port: uint16, startListening: bool, enableDiscovery: bool,
|
||||
else:
|
||||
try:
|
||||
let privKey = initPrivateKey(makeOpenArray(privateKey, 32))
|
||||
keypair = KeyPair(seckey: privKey, pubkey: privKey.getPublicKey())
|
||||
keypair = privKey.toKeyPair()
|
||||
|
||||
except EthKeysException:
|
||||
error "Passed an invalid private key."
|
||||
return false
|
||||
@ -176,8 +177,8 @@ proc nimbus_add_keypair(privateKey: ptr byte, id: var Identifier):
|
||||
|
||||
var keypair: KeyPair
|
||||
try:
|
||||
keypair.seckey = initPrivateKey(makeOpenArray(privateKey, 32))
|
||||
keypair.pubkey = keypair.seckey.getPublicKey()
|
||||
let privKey = initPrivateKey(makeOpenArray(privateKey, 32))
|
||||
keypair = privKey.toKeyPair()
|
||||
except EthKeysException, Secp256k1Exception:
|
||||
error "Passed an invalid private key."
|
||||
return false
|
||||
|
Loading…
x
Reference in New Issue
Block a user