Skip to content

Commit 5e54aa9

Browse files
committed
bench: remove global testWallet from CoinSelection benchmark
1 parent a5595b1 commit 5e54aa9

File tree

1 file changed

+2
-8
lines changed

1 file changed

+2
-8
lines changed

src/bench/coin_selection.cpp

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -65,21 +65,16 @@ static void CoinSelection(benchmark::Bench& bench)
6565
}
6666

6767
typedef std::set<CInputCoin> CoinSet;
68-
static NodeContext testNode;
69-
static auto testChain = interfaces::MakeChain(testNode);
70-
static CWallet testWallet(testChain.get(), "", CreateDummyWalletDatabase());
71-
std::vector<std::unique_ptr<CWalletTx>> wtxn;
7268

7369
// Copied from src/wallet/test/coinselector_tests.cpp
7470
static void add_coin(const CAmount& nValue, int nInput, std::vector<OutputGroup>& set)
7571
{
7672
CMutableTransaction tx;
7773
tx.vout.resize(nInput + 1);
7874
tx.vout[nInput].nValue = nValue;
79-
std::unique_ptr<CWalletTx> wtx = std::make_unique<CWalletTx>(MakeTransactionRef(std::move(tx)));
75+
CInputCoin coin(MakeTransactionRef(tx), nInput);
8076
set.emplace_back();
81-
set.back().Insert(COutput(testWallet, *wtx, nInput, 0, true, true, true).GetInputCoin(), 0, true, 0, 0, false);
82-
wtxn.emplace_back(std::move(wtx));
77+
set.back().Insert(coin, 0, true, 0, 0, false);
8378
}
8479
// Copied from src/wallet/test/coinselector_tests.cpp
8580
static CAmount make_hard_case(int utxos, std::vector<OutputGroup>& utxo_pool)
@@ -97,7 +92,6 @@ static CAmount make_hard_case(int utxos, std::vector<OutputGroup>& utxo_pool)
9792
static void BnBExhaustion(benchmark::Bench& bench)
9893
{
9994
// Setup
100-
testWallet.SetupLegacyScriptPubKeyMan();
10195
std::vector<OutputGroup> utxo_pool;
10296
CoinSet selection;
10397
CAmount value_ret = 0;

0 commit comments

Comments
 (0)