mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-03-28 16:36:04 +01:00
rpc: Push down safe mode checks
This contains most of the changes of 10563 "remove safe mode", but doesn't remove the safe mode yet, but put an `ObserveSafeMode()` check in individual calls with okSafeMode=false. This cleans up the ugly "okSafeMode" flag from the dispatch tables, which is not a concern for the RPC server. Extra-author: Wladimir J. van der Laan <laanwj@gmail.com>
This commit is contained in:
committed by
Wladimir J. van der Laan
parent
cee4fe1d53
commit
ec6902d0ea
14
src/rpc/safemode.cpp
Normal file
14
src/rpc/safemode.cpp
Normal file
@@ -0,0 +1,14 @@
|
||||
#include "safemode.h"
|
||||
|
||||
#include "rpc/protocol.h"
|
||||
#include "util.h"
|
||||
#include "warnings.h"
|
||||
|
||||
void ObserveSafeMode()
|
||||
{
|
||||
std::string warning = GetWarnings("rpc");
|
||||
if (warning != "" && !gArgs.GetBoolArg("-disablesafemode", DEFAULT_DISABLE_SAFEMODE)) {
|
||||
throw JSONRPCError(RPC_FORBIDDEN_BY_SAFE_MODE, std::string("Safe mode: ") + warning);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user