mirror of
https://github.com/status-im/nimbus-eth1.git
synced 2025-01-11 21:04:11 +00:00
eth_getUncleByBlockHashAndIndex, populate uncle hashes, not full uncles
This commit is contained in:
parent
5516a0dcfa
commit
cd85ed2281
@ -265,7 +265,9 @@ proc setupP2PRPC*(node: EthereumNode, rpcsrv: RpcServer) =
|
|||||||
result.gasUsed = header.gasUsed
|
result.gasUsed = header.gasUsed
|
||||||
result.timestamp = header.timeStamp
|
result.timestamp = header.timeStamp
|
||||||
result.transactions = blockBody.transactions
|
result.transactions = blockBody.transactions
|
||||||
result.uncles = blockBody.uncles
|
result.uncles = @[]
|
||||||
|
for i in 0 ..< blockBody.uncles.len:
|
||||||
|
result.uncles[i] = blockBody.uncles[i].hash
|
||||||
|
|
||||||
rpcsrv.rpc("eth_getBlockByHash") do(data: HexDataStr, fullTransactions: bool) -> BlockObject:
|
rpcsrv.rpc("eth_getBlockByHash") do(data: HexDataStr, fullTransactions: bool) -> BlockObject:
|
||||||
## Returns information about a block by hash.
|
## Returns information about a block by hash.
|
||||||
@ -413,13 +415,17 @@ proc setupP2PRPC*(node: EthereumNode, rpcsrv: RpcServer) =
|
|||||||
return populateReceipt(receipt, body.transactions[txDetails.index], txDetails.index, header)
|
return populateReceipt(receipt, body.transactions[txDetails.index], txDetails.index, header)
|
||||||
idx.inc
|
idx.inc
|
||||||
|
|
||||||
rpcsrv.rpc("eth_getUncleByBlockHashAndIndex") do(data: HexDataStr, quantity: int64) -> BlockObject:
|
rpcsrv.rpc("eth_getUncleByBlockHashAndIndex") do(data: HexDataStr, quantity: int) -> BlockObject:
|
||||||
## Returns information about a uncle of a block by hash and uncle index position.
|
## Returns information about a uncle of a block by hash and uncle index position.
|
||||||
##
|
##
|
||||||
## data: hash a block.
|
## data: hash of block.
|
||||||
## quantity: the uncle's index position.
|
## quantity: the uncle's index position.
|
||||||
## Returns BlockObject or nil when no block was found.
|
## Returns BlockObject or nil when no block was found.
|
||||||
discard
|
let
|
||||||
|
blockHash = data.string.strToHash()
|
||||||
|
body = chain.getBlockBody(blockHash)
|
||||||
|
uncle = body.uncles[quantity]
|
||||||
|
result = populateBlockObject(uncle, body)
|
||||||
|
|
||||||
rpcsrv.rpc("eth_getUncleByBlockNumberAndIndex") do(quantityTag: string, quantity: int64) -> BlockObject:
|
rpcsrv.rpc("eth_getUncleByBlockNumberAndIndex") do(quantityTag: string, quantity: int64) -> BlockObject:
|
||||||
# Returns information about a uncle of a block by number and uncle index position.
|
# Returns information about a uncle of a block by number and uncle index position.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user