Skip to content

Commit

Permalink
Merge pull request #2390 from ethereum/issue/2369
Browse files Browse the repository at this point in the history
GetBlockTransactionCountMethod fixed
  • Loading branch information
nivida authored Feb 20, 2019
2 parents 6698bfd + f7af2a9 commit 82819bc
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ export default class GetBlockTransactionCountMethod extends AbstractCallMethod {
* @constructor
*/
constructor(utils, formatters) {
super('eth_getTransactionByBlockNumberAndIndex', 1, utils, formatters);
super('eth_getBlockTransactionCountByNumber', 1, utils, formatters);
}

/**
Expand All @@ -42,7 +42,7 @@ export default class GetBlockTransactionCountMethod extends AbstractCallMethod {
*/
beforeExecution(moduleInstance) {
if (this.isHash(this.parameters[0])) {
this.rpcMethod = 'eth_getTransactionByBlockHashAndIndex';
this.rpcMethod = 'eth_getBlockTransactionCountByHash';
}

this.parameters[0] = this.formatters.inputBlockNumberFormatter(this.parameters[0]);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ describe('GetBlockTransactionCountMethod', () => {
it('constructor check', () => {
expect(method).toBeInstanceOf(AbstractCallMethod);

expect(method.rpcMethod).toEqual('eth_getTransactionByBlockNumberAndIndex');
expect(method.rpcMethod).toEqual('eth_getBlockTransactionCountByNumber');

expect(method.parametersAmount).toEqual(1);

Expand All @@ -40,7 +40,7 @@ describe('GetBlockTransactionCountMethod', () => {

expect(formatters.inputBlockNumberFormatter).toHaveBeenCalledWith('0x0');

expect(method.rpcMethod).toEqual('eth_getTransactionByBlockHashAndIndex');
expect(method.rpcMethod).toEqual('eth_getBlockTransactionCountByHash');
});

it('beforeExecution should call method with block number as parameter and call inputBlockNumberFormatter', () => {
Expand All @@ -54,7 +54,7 @@ describe('GetBlockTransactionCountMethod', () => {

expect(formatters.inputBlockNumberFormatter).toHaveBeenCalledWith(100);

expect(method.rpcMethod).toEqual('eth_getTransactionByBlockNumberAndIndex');
expect(method.rpcMethod).toEqual('eth_getBlockTransactionCountByNumber');
});

it('afterExecution should map the hex string to a number', () => {
Expand Down

0 comments on commit 82819bc

Please sign in to comment.