Skip to content
This repository was archived by the owner on Jul 1, 2021. It is now read-only.

Commit 96ce0ac

Browse files
committed
Implement eth_getTransactionByHash JSON RPC function
1 parent 3f80c22 commit 96ce0ac

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

trinity/rpc/modules/eth.py

+9
Original file line numberDiff line numberDiff line change
@@ -247,6 +247,15 @@ async def getTransactionCount(self, address: Address, at_block: Union[str, int])
247247
nonce = account_db.get_nonce(address)
248248
return hex(nonce)
249249

250+
@format_params(decode_hex)
251+
async def getTransactionByHash(self, transaction_hash: Hash32) -> Dict[str, str]:
252+
transaction_block_number, transaction_index = self._chain.chaindb.get_transaction_index(
253+
transaction_hash
254+
)
255+
block = await get_block_at_number(self._chain, transaction_block_number)
256+
transaction = block.transactions[transaction_index]
257+
return transaction_to_dict(transaction)
258+
250259
@format_params(decode_hex)
251260
async def getUncleCountByBlockHash(self, block_hash: Hash32) -> str:
252261
block = await self._chain.coro_get_block_by_hash(block_hash)

0 commit comments

Comments
 (0)