rpc: Return more specific reject reason for submitblock

This commit is contained in:
MarcoFalke
2018-08-15 13:54:36 -04:00
parent b5591ca0b0
commit fa6ab8ada1
2 changed files with 20 additions and 7 deletions

View File

@@ -750,11 +750,7 @@ static UniValue submitblock(const JSONRPCRequest& request)
RegisterValidationInterface(&sc);
bool accepted = ProcessNewBlock(Params(), blockptr, /* fForceProcessing */ true, /* fNewBlock */ &new_block);
UnregisterValidationInterface(&sc);
if (!new_block) {
if (!accepted) {
// TODO Maybe pass down fNewBlock to AcceptBlockHeader, so it is properly set to true in this case?
return "invalid";
}
if (!new_block && accepted) {
return "duplicate";
}
if (!sc.found) {