mirror of
https://github.com/dashpay/dash.git
synced 2024-12-25 20:12:57 +01:00
Check transaction count early in submitblock.
There is no point in even hashing a submitted block which doesn't have a coinbase transaction. This also results in more useful error reporting on corrupted input. Thanks to rawodb for the bug report.
This commit is contained in:
parent
ada0caa165
commit
4f15ea102d
@ -744,6 +744,10 @@ UniValue submitblock(const JSONRPCRequest& request)
|
||||
if (!DecodeHexBlk(block, request.params[0].get_str()))
|
||||
throw JSONRPCError(RPC_DESERIALIZATION_ERROR, "Block decode failed");
|
||||
|
||||
if (block.vtx.empty() || !block.vtx[0]->IsCoinBase()) {
|
||||
throw JSONRPCError(RPC_DESERIALIZATION_ERROR, "Block does not start with a coinbase");
|
||||
}
|
||||
|
||||
uint256 hash = block.GetHash();
|
||||
bool fBlockPresent = false;
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user