Skip to content

Commit 8383ed7

Browse files
authored
Merge pull request #1 from paulkeogh/master
Added a helper function to prefix params with a string of '0x' to
2 parents ef8045d + 994a980 commit 8383ed7

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

lib/logstash/inputs/protocols/ethereum.rb

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ def get_block_count
3030
public
3131
def get_block(height)
3232
# get the block data
33-
block_data = make_rpc_call('eth_getBlockByNumber', height, true)
33+
block_data = make_rpc_call('eth_getBlockByNumber', hexprefix(height), true)
3434

3535
# get all transaction data
3636
tx_info = block_data.delete('transactions')
@@ -57,6 +57,10 @@ def unhex(data, num_keys)
5757
end
5858
end
5959
end
60+
61+
def hexprefix(param)
62+
return '0x' + param.to_s
63+
end
6064
end
6165

6266
class String

0 commit comments

Comments
 (0)