mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-11-11 22:50:59 +01:00
refactor: Pass NodeContext to RPC and REST methods through util::Ref
This commit does not change behavior
This commit is contained in:
@@ -653,7 +653,7 @@ static UniValue combinerawtransaction(const JSONRPCRequest& request)
|
||||
CCoinsView viewDummy;
|
||||
CCoinsViewCache view(&viewDummy);
|
||||
{
|
||||
const CTxMemPool& mempool = EnsureMemPool();
|
||||
const CTxMemPool& mempool = EnsureMemPool(request.context);
|
||||
LOCK(cs_main);
|
||||
LOCK(mempool.cs);
|
||||
CCoinsViewCache &viewChain = ::ChainstateActive().CoinsTip();
|
||||
@@ -778,7 +778,8 @@ static UniValue signrawtransactionwithkey(const JSONRPCRequest& request)
|
||||
for (const CTxIn& txin : mtx.vin) {
|
||||
coins[txin.prevout]; // Create empty map entry keyed by prevout.
|
||||
}
|
||||
FindCoins(*g_rpc_node, coins);
|
||||
NodeContext& node = EnsureNodeContext(request.context);
|
||||
FindCoins(node, coins);
|
||||
|
||||
// Parse the prevtxs array
|
||||
ParsePrevouts(request.params[2], &keystore, coins);
|
||||
@@ -837,7 +838,8 @@ static UniValue sendrawtransaction(const JSONRPCRequest& request)
|
||||
|
||||
std::string err_string;
|
||||
AssertLockNotHeld(cs_main);
|
||||
const TransactionError err = BroadcastTransaction(*g_rpc_node, tx, err_string, max_raw_tx_fee, /*relay*/ true, /*wait_callback*/ true);
|
||||
NodeContext& node = EnsureNodeContext(request.context);
|
||||
const TransactionError err = BroadcastTransaction(node, tx, err_string, max_raw_tx_fee, /*relay*/ true, /*wait_callback*/ true);
|
||||
if (TransactionError::OK != err) {
|
||||
throw JSONRPCTransactionError(err, err_string);
|
||||
}
|
||||
@@ -904,7 +906,7 @@ static UniValue testmempoolaccept(const JSONRPCRequest& request)
|
||||
DEFAULT_MAX_RAW_TX_FEE_RATE :
|
||||
CFeeRate(AmountFromValue(request.params[1]));
|
||||
|
||||
CTxMemPool& mempool = EnsureMemPool();
|
||||
CTxMemPool& mempool = EnsureMemPool(request.context);
|
||||
int64_t virtual_size = GetVirtualTransactionSize(*tx);
|
||||
CAmount max_raw_tx_fee = max_raw_tx_fee_rate.GetFee(virtual_size);
|
||||
|
||||
@@ -1555,7 +1557,7 @@ UniValue utxoupdatepsbt(const JSONRPCRequest& request)
|
||||
CCoinsView viewDummy;
|
||||
CCoinsViewCache view(&viewDummy);
|
||||
{
|
||||
const CTxMemPool& mempool = EnsureMemPool();
|
||||
const CTxMemPool& mempool = EnsureMemPool(request.context);
|
||||
LOCK2(cs_main, mempool.cs);
|
||||
CCoinsViewCache &viewChain = ::ChainstateActive().CoinsTip();
|
||||
CCoinsViewMemPool viewMempool(&viewChain, mempool);
|
||||
|
||||
Reference in New Issue
Block a user