RPC: submitblock: Support for returning specific rejection reasons

This commit is contained in:
Luke Dashjr 2012-09-10 02:02:35 +00:00
parent 1bea2bbddc
commit e69a5873e7
1 changed files with 6 additions and 1 deletions

View File

@ -592,7 +592,12 @@ Value submitblock(const Array& params, bool fHelp)
throw JSONRPCError(RPC_VERIFY_ERROR, strRejectReason);
}
if (state.IsInvalid())
return "rejected"; // TODO: report validation state
{
std::string strRejectReason = state.GetRejectReason();
if (strRejectReason.empty())
return "rejected";
return strRejectReason;
}
return Value::null;
}