Unlike the submitblock
RPC which takes a fully serialized block, when a block solution is received via IPC the client only provides the nonce, coinbase and a few other fields. It may not have all the information it needs to reconstruct the block. This makes debugging difficult when the block is invalid.
This PR adds applySolution()
which returns the reconstructed block and can be used by the client for debugging. It’s assigned @11
in the .cap
file, and will not break existing client software.
It can also be used by the client for an alternative broadcast mechanism.
The tests cover both mainnet (unit tests) and regtest (functional tests), because the latter has SegWit active.
The second commit documents the fact that applySolution()
as well as the (already existing) submitSolution
are slightly different from the submitsolution
RPC in that they expect a complete coinbase transaction and will not automatically add a witness. This behavior is also covered in the functional test of the first commit.
This is alternative or complimentary approach to: