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:
Andrew Chow
2017-06-08 17:38:23 -07:00
committed by Wladimir J. van der Laan
parent cee4fe1d53
commit ec6902d0ea
14 changed files with 186 additions and 147 deletions

View File

@@ -4,6 +4,7 @@
#include "base58.h"
#include "chain.h"
#include "rpc/safemode.h"
#include "rpc/server.h"
#include "init.h"
#include "validation.h"
@@ -174,6 +175,7 @@ UniValue abortrescan(const JSONRPCRequest& request)
+ HelpExampleRpc("abortrescan", "")
);
ObserveSafeMode();
if (!pwallet->IsScanning() || pwallet->IsAbortingRescan()) return false;
pwallet->AbortRescan();
return true;