bcoin-org / bcoin

Javascript bitcoin library for node.js and browsers
https://bcoin.io
Other
3.01k stars 811 forks source link

Multiple RPC methods break when a miner is not set #726

Open braydonf opened 5 years ago

braydonf commented 5 years ago

Versions

bcoin v1.0.2

Expected

For RPC methods that require a miner to either allow for the address to be specified in the arguments or for the method to not be available.

Actual

./bin/bcoin-cli rpc help getwork
Cannot read property 'addresses' of null
./bin/bcoin-cli rpc getblocktemplate
Cannot read property 'createBlock' of null
./bin/bcoin-cli rpc generate 10
Cannot read property 'addresses' of null

Note: This was tested using an SPV node, however it could apply to other cases too.

Proposals

tynes commented 5 years ago

RPCs

getwork

The getwork RPC was removed in Bitcoin Core 0.10.0. If you have an older version of Bitcoin Core, use help getwork to get help. https://bitcoin.org/en/developer-reference#getwork

getblocktemplate

Probably do not want to allow this method in SPV mode

generate

Same as getblocktemplate, SPV doesn't make sense to have any mining RPCs

Summary

For your other cases, what else is there besides a BIP157/158 server? I think its a bad idea to allow for any mining related RPCs in general for SPV nodes. In non SPV mode, I like the idea of being able to specify the miner address for the calls, but without talking to some miners, its hard to know exactly what is most useful to them

braydonf commented 5 years ago

Right, so getwork can likely be deprecated, I think generate has been deprecated also to better seperate wallet and node, as there is generatetoaddress.