bench: remove global testWallet from CoinSelection benchmark
This commit is contained in:
1 parent
a5595b1320
commit
5e54aa9b90
1 file changed
+2
-8
@@ -65,10 +65,6 @@ static void CoinSelection(benchmark::Bench& bench)
|
|||||||
}
|
}
|
||||||
|
|
||||||
typedef std::set<CInputCoin> CoinSet;
|
typedef std::set<CInputCoin> CoinSet;
|
||||||
static NodeContext testNode;
|
|
||||||
static auto testChain = interfaces::MakeChain(testNode);
|
|
||||||
static CWallet testWallet(testChain.get(), "", CreateDummyWalletDatabase());
|
|
||||||
std::vector<std::unique_ptr<CWalletTx>> wtxn;
|
|
||||||
|
|
||||||
// Copied from src/wallet/test/coinselector_tests.cpp
|
// Copied from src/wallet/test/coinselector_tests.cpp
|
||||||
static void add_coin(const CAmount& nValue, int nInput, std::vector<OutputGroup>& set)
|
static void add_coin(const CAmount& nValue, int nInput, std::vector<OutputGroup>& set)
|
||||||
@@ -76,10 +72,9 @@ static void add_coin(const CAmount& nValue, int nInput, std::vector<OutputGroup>
|
|||||||
CMutableTransaction tx;
|
CMutableTransaction tx;
|
||||||
tx.vout.resize(nInput + 1);
|
tx.vout.resize(nInput + 1);
|
||||||
tx.vout[nInput].nValue = nValue;
|
tx.vout[nInput].nValue = nValue;
|
||||||
std::unique_ptr<CWalletTx> wtx = std::make_unique<CWalletTx>(MakeTransactionRef(std::move(tx)));
|
CInputCoin coin(MakeTransactionRef(tx), nInput);
|
||||||
set.emplace_back();
|
set.emplace_back();
|
||||||
set.back().Insert(COutput(testWallet, *wtx, nInput, 0, true, true, true).GetInputCoin(), 0, true, 0, 0, false);
|
set.back().Insert(coin, 0, true, 0, 0, false);
|
||||||
wtxn.emplace_back(std::move(wtx));
|
|
||||||
}
|
}
|
||||||
// Copied from src/wallet/test/coinselector_tests.cpp
|
// Copied from src/wallet/test/coinselector_tests.cpp
|
||||||
static CAmount make_hard_case(int utxos, std::vector<OutputGroup>& utxo_pool)
|
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)
|
|||||||
static void BnBExhaustion(benchmark::Bench& bench)
|
static void BnBExhaustion(benchmark::Bench& bench)
|
||||||
{
|
{
|
||||||
// Setup
|
// Setup
|
||||||
testWallet.SetupLegacyScriptPubKeyMan();
|
|
||||||
std::vector<OutputGroup> utxo_pool;
|
std::vector<OutputGroup> utxo_pool;
|
||||||
CoinSet selection;
|
CoinSet selection;
|
||||||
CAmount value_ret = 0;
|
CAmount value_ret = 0;
|
||||||
|
|||||||
Reference in new issue
Block a user