aboutsummaryrefslogtreecommitdiff
path: root/src/rpc/mining.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/rpc/mining.cpp')
-rw-r--r--src/rpc/mining.cpp34
1 files changed, 17 insertions, 17 deletions
diff --git a/src/rpc/mining.cpp b/src/rpc/mining.cpp
index 5136a4e3de..f72a19a8a1 100644
--- a/src/rpc/mining.cpp
+++ b/src/rpc/mining.cpp
@@ -101,7 +101,7 @@ static RPCHelpMan getnetworkhashps()
[&](const RPCHelpMan& self, const JSONRPCRequest& request) -> UniValue
{
LOCK(cs_main);
- const CChain& active_chain = EnsureChainman(request.context).ActiveChain();
+ const CChain& active_chain = EnsureAnyChainman(request.context).ActiveChain();
return GetNetworkHashPS(!request.params[0].isNull() ? request.params[0].get_int() : 120, !request.params[1].isNull() ? request.params[1].get_int() : -1, active_chain);
},
};
@@ -235,8 +235,8 @@ static RPCHelpMan generatetodescriptor()
throw JSONRPCError(RPC_INVALID_ADDRESS_OR_KEY, error);
}
- const CTxMemPool& mempool = EnsureMemPool(request.context);
- ChainstateManager& chainman = EnsureChainman(request.context);
+ const CTxMemPool& mempool = EnsureAnyMemPool(request.context);
+ ChainstateManager& chainman = EnsureAnyChainman(request.context);
return generateBlocks(chainman, mempool, coinbase_script, num_blocks, max_tries);
},
@@ -280,8 +280,8 @@ static RPCHelpMan generatetoaddress()
throw JSONRPCError(RPC_INVALID_ADDRESS_OR_KEY, "Error: Invalid address");
}
- const CTxMemPool& mempool = EnsureMemPool(request.context);
- ChainstateManager& chainman = EnsureChainman(request.context);
+ const CTxMemPool& mempool = EnsureAnyMemPool(request.context);
+ ChainstateManager& chainman = EnsureAnyChainman(request.context);
CScript coinbase_script = GetScriptForDestination(destination);
@@ -329,7 +329,7 @@ static RPCHelpMan generateblock()
coinbase_script = GetScriptForDestination(destination);
}
- const CTxMemPool& mempool = EnsureMemPool(request.context);
+ const CTxMemPool& mempool = EnsureAnyMemPool(request.context);
std::vector<CTransactionRef> txs;
const auto raw_txs_or_txids = request.params[1].get_array();
@@ -358,7 +358,7 @@ static RPCHelpMan generateblock()
CChainParams chainparams(Params());
CBlock block;
- ChainstateManager& chainman = EnsureChainman(request.context);
+ ChainstateManager& chainman = EnsureAnyChainman(request.context);
{
LOCK(cs_main);
@@ -425,8 +425,8 @@ static RPCHelpMan getmininginfo()
[&](const RPCHelpMan& self, const JSONRPCRequest& request) -> UniValue
{
LOCK(cs_main);
- const CTxMemPool& mempool = EnsureMemPool(request.context);
- const CChain& active_chain = EnsureChainman(request.context).ActiveChain();
+ const CTxMemPool& mempool = EnsureAnyMemPool(request.context);
+ const CChain& active_chain = EnsureAnyChainman(request.context).ActiveChain();
UniValue obj(UniValue::VOBJ);
obj.pushKV("blocks", (int)active_chain.Height());
@@ -474,7 +474,7 @@ static RPCHelpMan prioritisetransaction()
throw JSONRPCError(RPC_INVALID_PARAMETER, "Priority is no longer supported, dummy argument to prioritisetransaction must be 0.");
}
- EnsureMemPool(request.context).PrioritiseTransaction(hash, nAmount);
+ EnsureAnyMemPool(request.context).PrioritiseTransaction(hash, nAmount);
return true;
},
};
@@ -596,7 +596,7 @@ static RPCHelpMan getblocktemplate()
[&](const RPCHelpMan& self, const JSONRPCRequest& request) -> UniValue
{
LOCK(cs_main);
- ChainstateManager& chainman = EnsureChainman(request.context);
+ ChainstateManager& chainman = EnsureAnyChainman(request.context);
std::string strMode = "template";
UniValue lpval = NullUniValue;
@@ -663,7 +663,7 @@ static RPCHelpMan getblocktemplate()
if (strMode != "template")
throw JSONRPCError(RPC_INVALID_PARAMETER, "Invalid mode");
- NodeContext& node = EnsureNodeContext(request.context);
+ NodeContext& node = EnsureAnyNodeContext(request.context);
if(!node.connman)
throw JSONRPCError(RPC_CLIENT_P2P_DISABLED, "Error: Peer-to-peer functionality missing or disabled");
@@ -678,7 +678,7 @@ static RPCHelpMan getblocktemplate()
}
static unsigned int nTransactionsUpdatedLast;
- const CTxMemPool& mempool = EnsureMemPool(request.context);
+ const CTxMemPool& mempool = EnsureAnyMemPool(request.context);
if (!lpval.isNull())
{
@@ -975,7 +975,7 @@ static RPCHelpMan submitblock()
throw JSONRPCError(RPC_DESERIALIZATION_ERROR, "Block does not start with a coinbase");
}
- ChainstateManager& chainman = EnsureChainman(request.context);
+ ChainstateManager& chainman = EnsureAnyChainman(request.context);
uint256 hash = block.GetHash();
{
LOCK(cs_main);
@@ -1034,7 +1034,7 @@ static RPCHelpMan submitheader()
if (!DecodeHexBlockHeader(h, request.params[0].get_str())) {
throw JSONRPCError(RPC_DESERIALIZATION_ERROR, "Block header decode failed");
}
- ChainstateManager& chainman = EnsureChainman(request.context);
+ ChainstateManager& chainman = EnsureAnyChainman(request.context);
{
LOCK(cs_main);
if (!chainman.m_blockman.LookupBlockIndex(h.hashPrevBlock)) {
@@ -1092,7 +1092,7 @@ static RPCHelpMan estimatesmartfee()
RPCTypeCheck(request.params, {UniValue::VNUM, UniValue::VSTR});
RPCTypeCheckArgument(request.params[0], UniValue::VNUM);
- CBlockPolicyEstimator& fee_estimator = EnsureFeeEstimator(request.context);
+ CBlockPolicyEstimator& fee_estimator = EnsureAnyFeeEstimator(request.context);
unsigned int max_target = fee_estimator.HighestTargetTracked(FeeEstimateHorizon::LONG_HALFLIFE);
unsigned int conf_target = ParseConfirmTarget(request.params[0], max_target);
@@ -1180,7 +1180,7 @@ static RPCHelpMan estimaterawfee()
RPCTypeCheck(request.params, {UniValue::VNUM, UniValue::VNUM}, true);
RPCTypeCheckArgument(request.params[0], UniValue::VNUM);
- CBlockPolicyEstimator& fee_estimator = EnsureFeeEstimator(request.context);
+ CBlockPolicyEstimator& fee_estimator = EnsureAnyFeeEstimator(request.context);
unsigned int max_target = fee_estimator.HighestTargetTracked(FeeEstimateHorizon::LONG_HALFLIFE);
unsigned int conf_target = ParseConfirmTarget(request.params[0], max_target);