mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-03-19 04:00:01 +01:00
scripted-diff: rest/rpc: Use renamed EnsureAny*()
-BEGIN VERIFY SCRIPT-
sed -i -E 's@Ensure([^(]+)(\((request\.|)context\))@EnsureAny\1\2@g' \
-- src/rest.cpp src/rpc/*.cpp
-END VERIFY SCRIPT-
This commit is contained in:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user