ruimarinho / bitcoin-core

A modern Bitcoin Core REST and RPC client.
482 stars 188 forks source link

getBlockHeadersByHash Error: Extension "json" is not supported #76

Closed educob closed 5 years ago

educob commented 6 years ago

Hello.

I am receiving block notifications (via zmq) and by calling client.getBlockByHash (json extension) but when running: client.getBlockHeadersByHash( '00000xxxxx...', 1, { extension: 'json'})

I get: Error: Extension "json" is not supported

It works with extensions bin and hex.

Funny enough, json is the default option for this method.

Thanks.

educob commented 6 years ago

I found the error:

line 220: if (!_lodash.default.includes(['bin', 'hex'], extension)) { Must be changed to:if (!_lodash.default.includes(['bin', 'hex', 'json'], extension)) {

pedrobranco commented 5 years ago

Hi, many thanks for reporting the issue 👍

Since json extension support for this endpoint was introduced in version 0.12 of bitcoind, we haven't detected this change on the moment we have added support for 0.12 RPC methods.

I'm submitting a PR for fixing this issue.