mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-12-08 19:53:27 +01:00
Introduce Mining interface
Start out with a single method isTestChain() that's used by the getblocktemplate RPC.
This commit is contained in:
@@ -16,6 +16,7 @@
|
||||
#include <core_io.h>
|
||||
#include <deploymentinfo.h>
|
||||
#include <deploymentstatus.h>
|
||||
#include <interfaces/mining.h>
|
||||
#include <key_io.h>
|
||||
#include <net.h>
|
||||
#include <node/context.h>
|
||||
@@ -45,6 +46,7 @@
|
||||
|
||||
using node::BlockAssembler;
|
||||
using node::CBlockTemplate;
|
||||
using interfaces::Mining;
|
||||
using node::NodeContext;
|
||||
using node::RegenerateCommitments;
|
||||
using node::UpdateTime;
|
||||
@@ -724,7 +726,8 @@ static RPCHelpMan getblocktemplate()
|
||||
if (strMode != "template")
|
||||
throw JSONRPCError(RPC_INVALID_PARAMETER, "Invalid mode");
|
||||
|
||||
if (!chainman.GetParams().IsTestChain()) {
|
||||
Mining& miner = EnsureMining(node);
|
||||
if (!miner.isTestChain()) {
|
||||
const CConnman& connman = EnsureConnman(node);
|
||||
if (connman.GetNodeCount(ConnectionDirection::Both) == 0) {
|
||||
throw JSONRPCError(RPC_CLIENT_NOT_CONNECTED, PACKAGE_NAME " is not connected!");
|
||||
|
||||
Reference in New Issue
Block a user