This repository was archived by the owner on Feb 26, 2024. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +7
-9
lines changed
src/chains/ethereum/ethereum/src Expand file tree Collapse file tree 2 files changed +7
-9
lines changed Original file line number Diff line number Diff line change @@ -1266,14 +1266,12 @@ export default class EthereumApi implements Api {
12661266 @assertArgLength ( 1 )
12671267 async eth_getBlockTransactionCountByHash ( hash : DATA ) {
12681268 const { blocks } = this . #blockchain;
1269- const blockNum = await blocks . getNumberFromHash ( hash ) ;
1270- if ( ! blockNum ) return null ;
1271-
1272- const rawBlock = await blocks . getRawByBlockNumber ( Quantity . from ( blockNum ) ) ;
1273- if ( ! rawBlock ) return null ;
1274-
1275- const [ , rawTransactions ] = decode < GanacheRawBlock > ( rawBlock ) ;
1276- return Quantity . from ( rawTransactions . length ) ;
1269+ const block = await blocks
1270+ . getByHash ( hash )
1271+ . catch < Block > ( _ => null ) ;
1272+ if ( ! block ) return null ;
1273+ const transactions = block . getTransactions ( ) ;
1274+ return Quantity . from ( transactions . length ) ;
12771275 }
12781276
12791277 /**
Original file line number Diff line number Diff line change @@ -173,7 +173,7 @@ export default class BlockManager extends Manager<Block> {
173173 return Quantity . from ( tagOrBlockNumber ) ;
174174 }
175175
176- async getNumberFromHash ( hash : string | Buffer | Tag ) {
176+ private async getNumberFromHash ( hash : string | Buffer | Tag ) {
177177 return this . #blockIndexes. get ( Data . toBuffer ( hash ) ) . catch ( e => {
178178 if ( e . status === NOTFOUND ) return null ;
179179 throw e ;
You can’t perform that action at this time.
0 commit comments