mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-11-12 23:18:14 +01:00
Refactor: Allow LegacyScriptPubKeyMan to be null
In CWallet::LoadWallet, use this to detect and empty wallet with no keys This commit does not change behavior.
This commit is contained in:
@@ -136,6 +136,7 @@ BOOST_AUTO_TEST_CASE(bnb_search_test)
|
||||
{
|
||||
|
||||
LOCK(testWallet.cs_wallet);
|
||||
testWallet.SetupLegacyScriptPubKeyMan();
|
||||
|
||||
// Setup
|
||||
std::vector<CInputCoin> utxo_pool;
|
||||
@@ -278,6 +279,7 @@ BOOST_AUTO_TEST_CASE(bnb_search_test)
|
||||
std::unique_ptr<CWallet> wallet = MakeUnique<CWallet>(m_chain.get(), WalletLocation(), WalletDatabase::CreateMock());
|
||||
bool firstRun;
|
||||
wallet->LoadWallet(firstRun);
|
||||
wallet->SetupLegacyScriptPubKeyMan();
|
||||
LOCK(wallet->cs_wallet);
|
||||
add_coin(*wallet, 5 * CENT, 6 * 24, false, 0, true);
|
||||
add_coin(*wallet, 3 * CENT, 6 * 24, false, 0, true);
|
||||
@@ -299,6 +301,7 @@ BOOST_AUTO_TEST_CASE(knapsack_solver_test)
|
||||
bool bnb_used;
|
||||
|
||||
LOCK(testWallet.cs_wallet);
|
||||
testWallet.SetupLegacyScriptPubKeyMan();
|
||||
|
||||
// test multiple times to allow for differences in the shuffle order
|
||||
for (int i = 0; i < RUN_TESTS; i++)
|
||||
@@ -578,6 +581,7 @@ BOOST_AUTO_TEST_CASE(ApproximateBestSubset)
|
||||
bool bnb_used;
|
||||
|
||||
LOCK(testWallet.cs_wallet);
|
||||
testWallet.SetupLegacyScriptPubKeyMan();
|
||||
|
||||
empty_wallet();
|
||||
|
||||
@@ -596,6 +600,8 @@ BOOST_AUTO_TEST_CASE(ApproximateBestSubset)
|
||||
// Tests that with the ideal conditions, the coin selector will always be able to find a solution that can pay the target value
|
||||
BOOST_AUTO_TEST_CASE(SelectCoins_test)
|
||||
{
|
||||
testWallet.SetupLegacyScriptPubKeyMan();
|
||||
|
||||
// Random generator stuff
|
||||
std::default_random_engine generator;
|
||||
std::exponential_distribution<double> distribution (100);
|
||||
|
||||
Reference in New Issue
Block a user