vechain / rosetta

Rosetta Blockchain Standard Implementation for VeChain.
7 stars 5 forks source link

passing no block_identifier to /account/balance causes error #3

Closed stuartwk closed 3 years ago

stuartwk commented 3 years ago

In the /account/balance endpoint, block_identifier is an optional param.

In the AccountController, if there is no block_identifier, this leaves the revision param as undefined. https://github.com/vechain/rosetta/blob/master/src/app/controllers/account/controller.ts#L23

The revision param is passed to getAccountBalance and getBlockDetail. Inside of blockchainInfoService, there is the code https://github.com/vechain/rosetta/blob/master/src/server/service/blockchainInfoService.ts#L147. It is forcing revision to a string, though it is undefined, which throws the error cannot read 'toString' of property undefined.

mongelly commented 3 years ago

In the /account/balance endpoint, block_identifier is an optional param.

In the AccountController, if there is no block_identifier, this leaves the revision param as undefined. https://github.com/vechain/rosetta/blob/master/src/app/controllers/account/controller.ts#L23

The revision param is passed to getAccountBalance and getBlockDetail. Inside of blockchainInfoService, there is the code https://github.com/vechain/rosetta/blob/master/src/server/service/blockchainInfoService.ts#L147. It is forcing revision to a string, though it is undefined, which throws the error cannot read 'toString' of property undefined.

Hi @stuartkuentzel , thank you for your issus. i had fix it.