mempoolco / spruned

A Bitcoin-without-Blockchain client w/ RPC that can fetch any block or transaction
MIT License
170 stars 35 forks source link

Errors returned as results #52

Closed cdecker closed 6 years ago

cdecker commented 6 years ago

While trying to get c-lightning set up with spruned I noticed that it kept dying once it catches up with the blockchain head. The problem is that for blockheights that are above the current blockchain length the following is returned:

{"result": {"error": {"code": -8, "message": "Block height out of range"}}, "jsonrpc": "2.0", "error": null, "id": 1}

This is an error wrapped inside of a non-error return, which throws c-lightning off, and is likely to result in errors in other programs as well.

For comparison, bitcoind will return the following in the same situation:

{"result":null,"error":{"code":-8,"message":"Block height out of range"},"id":1}

Excellent work otherwise, been using spruned for a while now :+1:

gdassori commented 6 years ago

Thanks! Must be a regression due the lack of UT on the jsonrpc part, I'll look into it :-)

gdassori commented 6 years ago

27255d9 should fix the issue, along with a couple of tests on the jsonrpc interface

cdecker commented 6 years ago

I can confirm that it works :+1: