From 0e9edf80325eeea87e9e065d86b2e90e04af1517 Mon Sep 17 00:00:00 2001 From: coffeepots Date: Tue, 14 Aug 2018 16:55:28 +0100 Subject: [PATCH] eth_getUncleCountByBlockHash --- nimbus/rpc/p2p.nim | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/nimbus/rpc/p2p.nim b/nimbus/rpc/p2p.nim index 7f33761bc..69bfdccae 100644 --- a/nimbus/rpc/p2p.nim +++ b/nimbus/rpc/p2p.nim @@ -138,12 +138,15 @@ proc setupP2PRPC*(node: EthereumNode, rpcsrv: RpcServer) = body = chain.getBlockBody(header.stateRoot) result = body.transactions.len - rpcsrv.rpc("eth_getUncleCountByBlockHash") do(data: HexDataStr): + rpcsrv.rpc("eth_getUncleCountByBlockHash") do(data: HexDataStr) -> int: ## Returns the number of uncles in a block from a block matching the given block hash. ## ## data: hash of a block. ## Returns integer of the number of uncles in this block. - discard + var hashData: Hash256 + hashData.data = hexToPaddedByteArray[32](data.string) + let body = chain.getBlockBody(hashData) + result = body.uncles.len rpcsrv.rpc("eth_getUncleCountByBlockNumber") do(quantityTag: string): ## Returns the number of uncles in a block from a block matching the given block number.