Merge pull request #2653 from xanimo/1.14.5-submitblock-error
rpc: improve error message in submitblock
This commit is contained in:
commit
5df1b6af3e
|
@ -787,8 +787,14 @@ UniValue submitblock(const JSONRPCRequest& request)
|
||||||
if (!DecodeHexBlk(block, request.params[0].get_str()))
|
if (!DecodeHexBlk(block, request.params[0].get_str()))
|
||||||
throw JSONRPCError(RPC_DESERIALIZATION_ERROR, "Block decode failed");
|
throw JSONRPCError(RPC_DESERIALIZATION_ERROR, "Block decode failed");
|
||||||
|
|
||||||
if (block.vtx.empty() || !block.vtx[0]->IsCoinBase()) {
|
if (block.vtx.empty())
|
||||||
throw JSONRPCError(RPC_DESERIALIZATION_ERROR, "Block does not start with a coinbase");
|
{
|
||||||
|
throw JSONRPCError(RPC_DESERIALIZATION_ERROR, "Block does not contain a coinbase transaction");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!block.vtx[0]->IsCoinBase())
|
||||||
|
{
|
||||||
|
throw JSONRPCError(RPC_DESERIALIZATION_ERROR, "Block does not start with a valid coinbase transaction");
|
||||||
}
|
}
|
||||||
|
|
||||||
uint256 hash = block.GetHash();
|
uint256 hash = block.GetHash();
|
||||||
|
|
Loading…
Reference in a new issue