mirror of
https://github.com/status-im/nimbus-eth1.git
synced 2025-01-11 12:54:13 +00:00
Add hex data string checking to web3_sha3
This commit is contained in:
parent
6223a9a638
commit
3f1e140d59
@ -9,12 +9,12 @@
|
|||||||
import strutils, nimcrypto, eth_common, stint, eth_trie/[memdb, types]
|
import strutils, nimcrypto, eth_common, stint, eth_trie/[memdb, types]
|
||||||
import
|
import
|
||||||
json_rpc/server, ../vm_state, ../logging, ../db/[db_chain, state_db],
|
json_rpc/server, ../vm_state, ../logging, ../db/[db_chain, state_db],
|
||||||
../constants, ../config
|
../constants, ../config, hexstrings
|
||||||
|
|
||||||
proc setupCommonRPC*(server: RpcServer) =
|
proc setupCommonRPC*(server: RpcServer) =
|
||||||
server.rpc("web3_clientVersion") do() -> string:
|
server.rpc("web3_clientVersion") do() -> string:
|
||||||
result = NimbusIdent
|
result = NimbusIdent
|
||||||
|
|
||||||
server.rpc("web3_sha3") do(data: string) -> string:
|
server.rpc("web3_sha3") do(data: HexDataStr) -> string:
|
||||||
var rawdata = nimcrypto.fromHex(data)
|
var rawdata = nimcrypto.fromHex(data.string)
|
||||||
result = "0x" & $keccak_256.digest(rawdata)
|
result = "0x" & $keccak_256.digest(rawdata)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user