Skip to content
This repository was archived by the owner on Nov 30, 2021. It is now read-only.
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 13 additions & 2 deletions rpc/eth_api.go
Original file line number Diff line number Diff line change
Expand Up @@ -114,8 +114,19 @@ func (e *PublicEthAPI) GetBlockTransactionCountByHash(hash common.Hash) hexutil.
}

// GetBlockTransactionCountByNumber returns the number of transactions in the block identified by number.
func (e *PublicEthAPI) GetBlockTransactionCountByNumber(blockNum rpc.BlockNumber) hexutil.Uint {
return 0
func (e *PublicEthAPI) GetBlockTransactionCountByNumber(blockNum rpc.BlockNumber) (hexutil.Uint, error) {
node, err := e.cliCtx.GetNode()
if err != nil {
return 0, err
}

height := blockNum.Int64()
block, err := node.Block(&height)
if err != nil {
return 0, err
}

return hexutil.Uint(block.Block.NumTxs), nil
}

// GetUncleCountByBlockHash returns the number of uncles in the block idenfied by hash. Always zero.
Expand Down