mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-11-11 14:38:29 +01:00
refactor: Avoid locking tx pool cs thrice
This commit is contained in:
@@ -9,7 +9,7 @@
|
||||
#include <list>
|
||||
#include <vector>
|
||||
|
||||
static void AddTx(const CTransactionRef& tx, const CAmount& nFee, CTxMemPool& pool)
|
||||
static void AddTx(const CTransactionRef& tx, const CAmount& nFee, CTxMemPool& pool) EXCLUSIVE_LOCKS_REQUIRED(pool.cs)
|
||||
{
|
||||
int64_t nTime = 0;
|
||||
unsigned int nHeight = 1;
|
||||
@@ -108,6 +108,7 @@ static void MempoolEviction(benchmark::State& state)
|
||||
tx7.vout[1].nValue = 10 * COIN;
|
||||
|
||||
CTxMemPool pool;
|
||||
LOCK(pool.cs);
|
||||
// Create transaction references outside the "hot loop"
|
||||
const CTransactionRef tx1_r{MakeTransactionRef(tx1)};
|
||||
const CTransactionRef tx2_r{MakeTransactionRef(tx2)};
|
||||
|
||||
Reference in New Issue
Block a user