diff options
author | Anthony Towns <aj@erisian.com.au> | 2020-09-10 08:06:34 +1000 |
---|---|---|
committer | Anthony Towns <aj@erisian.com.au> | 2020-12-14 18:32:57 +1000 |
commit | 95d5d5e6257825bb385cee318d5681597f7f7646 (patch) | |
tree | b5223236a85cc0088ba764e037e4571198dd1836 /src/rpc | |
parent | 81c54dec20891f2627a49b2e3e785fdaf2a1e664 (diff) | |
download | bitcoin-95d5d5e6257825bb385cee318d5681597f7f7646.tar.xz |
rpc: allow getblocktemplate for test chains when unconnected or in IBD
Diffstat (limited to 'src/rpc')
-rw-r--r-- | src/rpc/mining.cpp | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/src/rpc/mining.cpp b/src/rpc/mining.cpp index eb2376329c..3d71bdebe9 100644 --- a/src/rpc/mining.cpp +++ b/src/rpc/mining.cpp @@ -658,11 +658,15 @@ static RPCHelpMan getblocktemplate() if(!node.connman) throw JSONRPCError(RPC_CLIENT_P2P_DISABLED, "Error: Peer-to-peer functionality missing or disabled"); - if (node.connman->GetNodeCount(CConnman::CONNECTIONS_ALL) == 0) - throw JSONRPCError(RPC_CLIENT_NOT_CONNECTED, PACKAGE_NAME " is not connected!"); + if (!Params().IsTestChain()) { + if (node.connman->GetNodeCount(CConnman::CONNECTIONS_ALL) == 0) { + throw JSONRPCError(RPC_CLIENT_NOT_CONNECTED, PACKAGE_NAME " is not connected!"); + } - if (::ChainstateActive().IsInitialBlockDownload()) - throw JSONRPCError(RPC_CLIENT_IN_INITIAL_DOWNLOAD, PACKAGE_NAME " is in initial sync and waiting for blocks..."); + if (::ChainstateActive().IsInitialBlockDownload()) { + throw JSONRPCError(RPC_CLIENT_IN_INITIAL_DOWNLOAD, PACKAGE_NAME " is in initial sync and waiting for blocks..."); + } + } static unsigned int nTransactionsUpdatedLast; const CTxMemPool& mempool = EnsureMemPool(request.context); |