mirror of
https://github.com/ElementsProject/elements.git
synced 2026-08-13 12:33:42 +02:00
Merge #17564: rpc: Use mempool from node context instead of global
fa8e650b52rest: Use mempool from node context instead of global (MarcoFalke)fa660d65d7node: Use mempool from node context instead of global (MarcoFalke)facbaf092frpc: Use mempool from node context instead of global (MarcoFalke) Pull request description: Currently they are identical, but in the future we might want to turn the mempool into a unique_ptr. Replacing the global with the mempool pointer from the node context simplifies this step. ACKs for top commit: jnewbery: Code review ACKfa8e650b5ryanofsky: Code review ACKfa8e650b52, Only the discussed REST server changes since the last review. Tree-SHA512: 0836f3f39cf90306455962918446e5f8612e88c32072b92afc30929aea1f17430bbda0e2b3668d36c9d6b97d63a93cf4903185194571108642b7bf5a39b89125
This commit is contained in:
commit
48d64d73c0
11 changed files with 68 additions and 30 deletions
|
|
@ -244,6 +244,7 @@ static UniValue getmininginfo(const JSONRPCRequest& request)
|
|||
}.Check(request);
|
||||
|
||||
LOCK(cs_main);
|
||||
const CTxMemPool& mempool = EnsureMemPool();
|
||||
|
||||
UniValue obj(UniValue::VOBJ);
|
||||
obj.pushKV("blocks", (int)::ChainActive().Height());
|
||||
|
|
@ -290,7 +291,7 @@ static UniValue prioritisetransaction(const JSONRPCRequest& request)
|
|||
throw JSONRPCError(RPC_INVALID_PARAMETER, "Priority is no longer supported, dummy argument to prioritisetransaction must be 0.");
|
||||
}
|
||||
|
||||
mempool.PrioritiseTransaction(hash, nAmount);
|
||||
EnsureMemPool().PrioritiseTransaction(hash, nAmount);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
@ -476,6 +477,7 @@ static UniValue getblocktemplate(const JSONRPCRequest& request)
|
|||
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();
|
||||
|
||||
if (!lpval.isNull())
|
||||
{
|
||||
|
|
@ -510,7 +512,7 @@ static UniValue getblocktemplate(const JSONRPCRequest& request)
|
|||
if (g_best_block_cv.wait_until(lock, checktxtime) == std::cv_status::timeout)
|
||||
{
|
||||
// Timeout: Check transactions for update
|
||||
// without holding ::mempool.cs to avoid deadlocks
|
||||
// without holding the mempool lock to avoid deadlocks
|
||||
if (mempool.GetTransactionsUpdated() != nTransactionsUpdatedLastLP)
|
||||
break;
|
||||
checktxtime += std::chrono::seconds(10);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue