Skip to content

Commit 95d5d5e

Browse files
committed
rpc: allow getblocktemplate for test chains when unconnected or in IBD
1 parent 81c54de commit 95d5d5e

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

src/rpc/mining.cpp

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -658,11 +658,15 @@ static RPCHelpMan getblocktemplate()
658658
if(!node.connman)
659659
throw JSONRPCError(RPC_CLIENT_P2P_DISABLED, "Error: Peer-to-peer functionality missing or disabled");
660660

661-
if (node.connman->GetNodeCount(CConnman::CONNECTIONS_ALL) == 0)
662-
throw JSONRPCError(RPC_CLIENT_NOT_CONNECTED, PACKAGE_NAME " is not connected!");
661+
if (!Params().IsTestChain()) {
662+
if (node.connman->GetNodeCount(CConnman::CONNECTIONS_ALL) == 0) {
663+
throw JSONRPCError(RPC_CLIENT_NOT_CONNECTED, PACKAGE_NAME " is not connected!");
664+
}
663665

664-
if (::ChainstateActive().IsInitialBlockDownload())
665-
throw JSONRPCError(RPC_CLIENT_IN_INITIAL_DOWNLOAD, PACKAGE_NAME " is in initial sync and waiting for blocks...");
666+
if (::ChainstateActive().IsInitialBlockDownload()) {
667+
throw JSONRPCError(RPC_CLIENT_IN_INITIAL_DOWNLOAD, PACKAGE_NAME " is in initial sync and waiting for blocks...");
668+
}
669+
}
666670

667671
static unsigned int nTransactionsUpdatedLast;
668672
const CTxMemPool& mempool = EnsureMemPool(request.context);

0 commit comments

Comments
 (0)