From 8d4c00cd3fe9778468868823c1815f129e58752e Mon Sep 17 00:00:00 2001 From: coffeepots Date: Thu, 29 Nov 2018 17:08:13 +0000 Subject: [PATCH] Removed utils from p2p and updated names in rpc_utils --- nimbus/rpc/p2p.nim | 8 -------- nimbus/rpc/rpc_utils.nim | 7 ++++--- 2 files changed, 4 insertions(+), 11 deletions(-) diff --git a/nimbus/rpc/p2p.nim b/nimbus/rpc/p2p.nim index a994db0bc..b222c14b0 100644 --- a/nimbus/rpc/p2p.nim +++ b/nimbus/rpc/p2p.nim @@ -29,14 +29,6 @@ import proc `%`*(value: Time): JsonNode = result = %value.toSeconds -func toAddress(value: EthAddressStr): EthAddress = hexToPaddedByteArray[20](value.string) - -func toHash(value: array[32, byte]): Hash256 {.inline.} = - result.data = value - -func toHash(value: EthHashStr): Hash256 {.inline.} = - result = hexToPaddedByteArray[32](value.string).toHash - template balance(addressDb: AccountStateDb, address: EthAddress): GasInt = # TODO: Account balance u256 but GasInt is int64? addressDb.getBalance(address).truncate(int64) diff --git a/nimbus/rpc/rpc_utils.nim b/nimbus/rpc/rpc_utils.nim index 93d032212..89c110005 100644 --- a/nimbus/rpc/rpc_utils.nim +++ b/nimbus/rpc/rpc_utils.nim @@ -9,10 +9,11 @@ import hexstrings, nimcrypto, eth_common, byteutils -func strToAddress*(value: string): EthAddress = hexToPaddedByteArray[20](value) +func toAddress*(value: EthAddressStr): EthAddress = hexToPaddedByteArray[20](value.string) func toHash*(value: array[32, byte]): Hash256 {.inline.} = result.data = value -func strToHash*(value: string): Hash256 {.inline.} = - result = hexToPaddedByteArray[32](value).toHash +func toHash*(value: EthHashStr): Hash256 {.inline.} = + result = hexToPaddedByteArray[32](value.string).toHash +