mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-04-04 21:04:58 +02:00
Consistently use FormatStateMessage in RPC error output
This will include the error code and debug output as well as the reason string. See #11955 for the motivation.
This commit is contained in:
@@ -1434,7 +1434,7 @@ UniValue preciousblock(const JSONRPCRequest& request)
|
||||
PreciousBlock(state, Params(), pblockindex);
|
||||
|
||||
if (!state.IsValid()) {
|
||||
throw JSONRPCError(RPC_DATABASE_ERROR, state.GetRejectReason());
|
||||
throw JSONRPCError(RPC_DATABASE_ERROR, FormatStateMessage(state));
|
||||
}
|
||||
|
||||
return NullUniValue;
|
||||
@@ -1472,7 +1472,7 @@ UniValue invalidateblock(const JSONRPCRequest& request)
|
||||
}
|
||||
|
||||
if (!state.IsValid()) {
|
||||
throw JSONRPCError(RPC_DATABASE_ERROR, state.GetRejectReason());
|
||||
throw JSONRPCError(RPC_DATABASE_ERROR, FormatStateMessage(state));
|
||||
}
|
||||
|
||||
return NullUniValue;
|
||||
@@ -1509,7 +1509,7 @@ UniValue reconsiderblock(const JSONRPCRequest& request)
|
||||
ActivateBestChain(state, Params());
|
||||
|
||||
if (!state.IsValid()) {
|
||||
throw JSONRPCError(RPC_DATABASE_ERROR, state.GetRejectReason());
|
||||
throw JSONRPCError(RPC_DATABASE_ERROR, FormatStateMessage(state));
|
||||
}
|
||||
|
||||
return NullUniValue;
|
||||
@@ -1563,7 +1563,7 @@ UniValue getchaintxstats(const JSONRPCRequest& request)
|
||||
pindex = chainActive.Tip();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
assert(pindex != nullptr);
|
||||
|
||||
if (request.params[0].isNull()) {
|
||||
|
||||
Reference in New Issue
Block a user