Merge 25ad2c623a into merged_master (Bitcoin PR #18740)

This commit is contained in:
Andrew Poelstra 2020-11-26 01:08:47 +00:00
commit 51965ad1e6
23 changed files with 264 additions and 133 deletions

View file

@ -247,7 +247,7 @@ static UniValue generatetodescriptor(const JSONRPCRequest& request)
throw JSONRPCError(RPC_INVALID_ADDRESS_OR_KEY, error);
}
const CTxMemPool& mempool = EnsureMemPool();
const CTxMemPool& mempool = EnsureMemPool(request.context);
return generateBlocks(mempool, coinbase_script, num_blocks, max_tries);
}
@ -285,7 +285,7 @@ static UniValue generatetoaddress(const JSONRPCRequest& request)
throw JSONRPCError(RPC_INVALID_ADDRESS_OR_KEY, "Error: Invalid address");
}
const CTxMemPool& mempool = EnsureMemPool();
const CTxMemPool& mempool = EnsureMemPool(request.context);
CScript coinbase_script = GetScriptForDestination(destination);
@ -331,7 +331,7 @@ static UniValue generateblock(const JSONRPCRequest& request)
coinbase_script = GetScriptForDestination(destination);
}
const CTxMemPool& mempool = EnsureMemPool();
const CTxMemPool& mempool = EnsureMemPool(request.context);
std::vector<CTransactionRef> txs;
const auto raw_txs_or_txids = request.params[1].get_array();
@ -423,7 +423,7 @@ static UniValue getmininginfo(const JSONRPCRequest& request)
}.Check(request);
LOCK(cs_main);
const CTxMemPool& mempool = EnsureMemPool();
const CTxMemPool& mempool = EnsureMemPool(request.context);
UniValue obj(UniValue::VOBJ);
obj.pushKV("blocks", (int)::ChainActive().Height());
@ -471,7 +471,7 @@ static UniValue prioritisetransaction(const JSONRPCRequest& request)
throw JSONRPCError(RPC_INVALID_PARAMETER, "Priority is no longer supported, dummy argument to prioritisetransaction must be 0.");
}
EnsureMemPool().PrioritiseTransaction(hash, nAmount);
EnsureMemPool(request.context).PrioritiseTransaction(hash, nAmount);
return true;
}
@ -657,17 +657,18 @@ static UniValue getblocktemplate(const JSONRPCRequest& request)
if (strMode != "template")
throw JSONRPCError(RPC_INVALID_PARAMETER, "Invalid mode");
if(!g_rpc_node->connman)
NodeContext& node = EnsureNodeContext(request.context);
if(!node.connman)
throw JSONRPCError(RPC_CLIENT_P2P_DISABLED, "Error: Peer-to-peer functionality missing or disabled");
if (g_rpc_node->connman->GetNodeCount(CConnman::CONNECTIONS_ALL) == 0)
if (node.connman->GetNodeCount(CConnman::CONNECTIONS_ALL) == 0)
throw JSONRPCError(RPC_CLIENT_NOT_CONNECTED, PACKAGE_NAME " is not connected!");
if (::ChainstateActive().IsInitialBlockDownload())
throw JSONRPCError(RPC_CLIENT_IN_INITIAL_DOWNLOAD, PACKAGE_NAME " is in initial sync and waiting for blocks...");
static unsigned int nTransactionsUpdatedLast;
const CTxMemPool& mempool = EnsureMemPool();
const CTxMemPool& mempool = EnsureMemPool(request.context);
if (!lpval.isNull())
{