From 379679556607614e82ec7fbbaf5c37373c50ce96 Mon Sep 17 00:00:00 2001 From: Duke Leto Date: Wed, 19 May 2021 12:04:04 -0400 Subject: [PATCH] Allow help, z_listaddresses, listaddresses, z_exportkey and dumpprivkey during RPC warmup --- src/rpc/server.cpp | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/rpc/server.cpp b/src/rpc/server.cpp index 5ae2c88e1..bf99a5b78 100644 --- a/src/rpc/server.cpp +++ b/src/rpc/server.cpp @@ -825,9 +825,13 @@ UniValue CRPCTable::execute(const std::string &strMethod, const UniValue ¶ms { LOCK(cs_rpcWarmup); if (fRPCInWarmup) { - // hush-cli stop is the only valid RPC command during warmup - // We don't know if we have valid blocks or wallet yet, nothing else is safe - if (pcmd->name != "stop") { + // Most RPCs are unsafe to run during warmup, but stop+help are fine + // Others may not have data loaded yet, such as wallet details, but + // those RPCs are written defensively to deal with that. Allowing these + // few RPCs means we can see our addresses and make private key backups + // while a very long wallet rescan is happening + if (pcmd->name != "stop" && pcmd->name != "help" && pcmd->name != "z_listaddresses" && pcmd->name != "z_exportkey" && + pcmd->name != "listaddresses" && pcmd->name != "dumpprivkey" ) { throw JSONRPCError(RPC_IN_WARMUP, rpcWarmupStatus); } }