diff options
Diffstat (limited to 'src/rpc/mining.cpp')
-rw-r--r-- | src/rpc/mining.cpp | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/src/rpc/mining.cpp b/src/rpc/mining.cpp index 0cef310c50..abb5a0b3a1 100644 --- a/src/rpc/mining.cpp +++ b/src/rpc/mining.cpp @@ -18,6 +18,7 @@ #include <pow.h> #include <rpc/blockchain.h> #include <rpc/mining.h> +#include <rpc/net.h> #include <rpc/server.h> #include <rpc/util.h> #include <script/descriptor.h> @@ -671,11 +672,9 @@ static RPCHelpMan getblocktemplate() if (strMode != "template") throw JSONRPCError(RPC_INVALID_PARAMETER, "Invalid mode"); - if(!node.connman) - throw JSONRPCError(RPC_CLIENT_P2P_DISABLED, "Error: Peer-to-peer functionality missing or disabled"); - if (!Params().IsTestChain()) { - if (node.connman->GetNodeCount(ConnectionDirection::Both) == 0) { + const CConnman& connman = EnsureConnman(node); + if (connman.GetNodeCount(ConnectionDirection::Both) == 0) { throw JSONRPCError(RPC_CLIENT_NOT_CONNECTED, PACKAGE_NAME " is not connected!"); } |