Skip to content

Commit 6c9b342

Browse files
committed
refactor: wallet, remove global 'ArgsManager' access
we are not using it anymore
1 parent d8f5fc4 commit 6c9b342

19 files changed

+89
-93
lines changed

src/bench/coin_selection.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ static void CoinSelection(benchmark::Bench& bench)
4545
{
4646
NodeContext node;
4747
auto chain = interfaces::MakeChain(node);
48-
CWallet wallet(chain.get(), "", gArgs, CreateDummyWalletDatabase());
48+
CWallet wallet(chain.get(), "", CreateDummyWalletDatabase());
4949
std::vector<std::unique_ptr<CWalletTx>> wtxs;
5050
LOCK(wallet.cs_wallet);
5151

src/bench/wallet_balance.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ static void WalletBalance(benchmark::Bench& bench, const bool set_dirty, const b
2828

2929
const auto& ADDRESS_WATCHONLY = ADDRESS_BCRT1_UNSPENDABLE;
3030

31-
CWallet wallet{test_setup->m_node.chain.get(), "", gArgs, CreateMockWalletDatabase()};
31+
CWallet wallet{test_setup->m_node.chain.get(), "", CreateMockWalletDatabase()};
3232
{
3333
LOCK(wallet.cs_wallet);
3434
wallet.SetWalletFlag(WALLET_FLAG_DESCRIPTORS);

src/bench/wallet_create_tx.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ static void WalletCreateTx(benchmark::Bench& bench, const OutputType output_type
8383
{
8484
const auto test_setup = MakeNoLogFileContext<const TestingSetup>();
8585

86-
CWallet wallet{test_setup->m_node.chain.get(), "", gArgs, CreateMockWalletDatabase()};
86+
CWallet wallet{test_setup->m_node.chain.get(), "", CreateMockWalletDatabase()};
8787
{
8888
LOCK(wallet.cs_wallet);
8989
wallet.SetWalletFlag(WALLET_FLAG_DESCRIPTORS);
@@ -136,7 +136,7 @@ static void WalletCreateTx(benchmark::Bench& bench, const OutputType output_type
136136
static void AvailableCoins(benchmark::Bench& bench, const std::vector<OutputType>& output_type)
137137
{
138138
const auto test_setup = MakeNoLogFileContext<const TestingSetup>();
139-
CWallet wallet{test_setup->m_node.chain.get(), "", gArgs, CreateMockWalletDatabase()};
139+
CWallet wallet{test_setup->m_node.chain.get(), "", CreateMockWalletDatabase()};
140140
{
141141
LOCK(wallet.cs_wallet);
142142
wallet.SetWalletFlag(WALLET_FLAG_DESCRIPTORS);

src/qt/test/addressbooktests.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ void TestAddAddressesToSendBook(interfaces::Node& node)
7575
auto wallet_loader = interfaces::MakeWalletLoader(*test.m_node.chain, *Assert(test.m_node.args));
7676
test.m_node.wallet_loader = wallet_loader.get();
7777
node.setContext(&test.m_node);
78-
const std::shared_ptr<CWallet> wallet = std::make_shared<CWallet>(node.context()->chain.get(), "", gArgs, CreateMockWalletDatabase());
78+
const std::shared_ptr<CWallet> wallet = std::make_shared<CWallet>(node.context()->chain.get(), "", CreateMockWalletDatabase());
7979
wallet->LoadWallet();
8080
wallet->SetWalletFlag(WALLET_FLAG_DESCRIPTORS);
8181
{

src/qt/test/wallettests.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,7 @@ void TestGUI(interfaces::Node& node)
159159
auto wallet_loader = interfaces::MakeWalletLoader(*test.m_node.chain, *Assert(test.m_node.args));
160160
test.m_node.wallet_loader = wallet_loader.get();
161161
node.setContext(&test.m_node);
162-
const std::shared_ptr<CWallet> wallet = std::make_shared<CWallet>(node.context()->chain.get(), "", gArgs, CreateMockWalletDatabase());
162+
const std::shared_ptr<CWallet> wallet = std::make_shared<CWallet>(node.context()->chain.get(), "", CreateMockWalletDatabase());
163163
wallet->LoadWallet();
164164
wallet->SetWalletFlag(WALLET_FLAG_DESCRIPTORS);
165165
{

src/wallet/dump.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -202,7 +202,7 @@ bool CreateFromDump(const ArgsManager& args, const std::string& name, const fs::
202202

203203
// dummy chain interface
204204
bool ret = true;
205-
std::shared_ptr<CWallet> wallet(new CWallet(/*chain=*/nullptr, name, gArgs, std::move(database)), WalletToolReleaseWallet);
205+
std::shared_ptr<CWallet> wallet(new CWallet(/*chain=*/nullptr, name, std::move(database)), WalletToolReleaseWallet);
206206
{
207207
LOCK(wallet->cs_wallet);
208208
DBErrors load_wallet_ret = wallet->LoadWallet();

src/wallet/salvage.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ bool RecoverDatabaseFile(const ArgsManager& args, const fs::path& file_path, bil
135135
}
136136

137137
DbTxn* ptxn = env->TxnBegin();
138-
CWallet dummyWallet(nullptr, "", gArgs, CreateDummyWalletDatabase());
138+
CWallet dummyWallet(nullptr, "", CreateDummyWalletDatabase());
139139
for (KeyValPair& row : salvagedData)
140140
{
141141
/* Filter for only private key type KV pairs to be added to the salvaged wallet */

src/wallet/test/coinselector_tests.cpp

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -305,7 +305,7 @@ BOOST_AUTO_TEST_CASE(bnb_search_test)
305305
coin_selection_params_bnb.m_subtract_fee_outputs = true;
306306

307307
{
308-
std::unique_ptr<CWallet> wallet = std::make_unique<CWallet>(m_node.chain.get(), "", m_args, CreateMockWalletDatabase());
308+
std::unique_ptr<CWallet> wallet = std::make_unique<CWallet>(m_node.chain.get(), "", CreateMockWalletDatabase());
309309
wallet->LoadWallet();
310310
LOCK(wallet->cs_wallet);
311311
wallet->SetWalletFlag(WALLET_FLAG_DESCRIPTORS);
@@ -327,7 +327,7 @@ BOOST_AUTO_TEST_CASE(bnb_search_test)
327327
}
328328

329329
{
330-
std::unique_ptr<CWallet> wallet = std::make_unique<CWallet>(m_node.chain.get(), "", m_args, CreateMockWalletDatabase());
330+
std::unique_ptr<CWallet> wallet = std::make_unique<CWallet>(m_node.chain.get(), "", CreateMockWalletDatabase());
331331
wallet->LoadWallet();
332332
LOCK(wallet->cs_wallet);
333333
wallet->SetWalletFlag(WALLET_FLAG_DESCRIPTORS);
@@ -350,7 +350,7 @@ BOOST_AUTO_TEST_CASE(bnb_search_test)
350350
BOOST_CHECK(result10);
351351
}
352352
{
353-
std::unique_ptr<CWallet> wallet = std::make_unique<CWallet>(m_node.chain.get(), "", m_args, CreateMockWalletDatabase());
353+
std::unique_ptr<CWallet> wallet = std::make_unique<CWallet>(m_node.chain.get(), "", CreateMockWalletDatabase());
354354
wallet->LoadWallet();
355355
LOCK(wallet->cs_wallet);
356356
wallet->SetWalletFlag(WALLET_FLAG_DESCRIPTORS);
@@ -415,7 +415,7 @@ BOOST_AUTO_TEST_CASE(knapsack_solver_test)
415415
FastRandomContext rand{};
416416
const auto temp1{[&rand](std::vector<OutputGroup>& g, const CAmount& v, CAmount c) { return KnapsackSolver(g, v, c, rand); }};
417417
const auto KnapsackSolver{temp1};
418-
std::unique_ptr<CWallet> wallet = std::make_unique<CWallet>(m_node.chain.get(), "", m_args, CreateMockWalletDatabase());
418+
std::unique_ptr<CWallet> wallet = std::make_unique<CWallet>(m_node.chain.get(), "", CreateMockWalletDatabase());
419419
wallet->LoadWallet();
420420
LOCK(wallet->cs_wallet);
421421
wallet->SetWalletFlag(WALLET_FLAG_DESCRIPTORS);
@@ -725,7 +725,7 @@ BOOST_AUTO_TEST_CASE(knapsack_solver_test)
725725
BOOST_AUTO_TEST_CASE(ApproximateBestSubset)
726726
{
727727
FastRandomContext rand{};
728-
std::unique_ptr<CWallet> wallet = std::make_unique<CWallet>(m_node.chain.get(), "", m_args, CreateMockWalletDatabase());
728+
std::unique_ptr<CWallet> wallet = std::make_unique<CWallet>(m_node.chain.get(), "", CreateMockWalletDatabase());
729729
wallet->LoadWallet();
730730
LOCK(wallet->cs_wallet);
731731
wallet->SetWalletFlag(WALLET_FLAG_DESCRIPTORS);
@@ -747,7 +747,7 @@ BOOST_AUTO_TEST_CASE(ApproximateBestSubset)
747747
// Tests that with the ideal conditions, the coin selector will always be able to find a solution that can pay the target value
748748
BOOST_AUTO_TEST_CASE(SelectCoins_test)
749749
{
750-
std::unique_ptr<CWallet> wallet = std::make_unique<CWallet>(m_node.chain.get(), "", m_args, CreateMockWalletDatabase());
750+
std::unique_ptr<CWallet> wallet = std::make_unique<CWallet>(m_node.chain.get(), "", CreateMockWalletDatabase());
751751
wallet->LoadWallet();
752752
LOCK(wallet->cs_wallet);
753753
wallet->SetWalletFlag(WALLET_FLAG_DESCRIPTORS);
@@ -934,7 +934,7 @@ BOOST_AUTO_TEST_CASE(effective_value_test)
934934

935935
static util::Result<SelectionResult> select_coins(const CAmount& target, const CoinSelectionParams& cs_params, const CCoinControl& cc, std::function<CoinsResult(CWallet&)> coin_setup, interfaces::Chain* chain)
936936
{
937-
std::unique_ptr<CWallet> wallet = std::make_unique<CWallet>(chain, "", args, CreateMockWalletDatabase());
937+
std::unique_ptr<CWallet> wallet = std::make_unique<CWallet>(chain, "", CreateMockWalletDatabase());
938938
wallet->LoadWallet();
939939
LOCK(wallet->cs_wallet);
940940
wallet->SetWalletFlag(WALLET_FLAG_DESCRIPTORS);
@@ -1056,15 +1056,15 @@ BOOST_AUTO_TEST_CASE(SelectCoins_effective_value_test)
10561056
// This test creates a coin whose value is higher than the target but whose effective value is lower than the target.
10571057
// The coin is selected using coin control, with m_allow_other_inputs = false. SelectCoins should fail due to insufficient funds.
10581058

1059-
std::unique_ptr<CWallet> wallet = std::make_unique<CWallet>(m_node.chain.get(), "", m_args, CreateMockWalletDatabase());
1059+
std::unique_ptr<CWallet> wallet = std::make_unique<CWallet>(m_node.chain.get(), "", CreateMockWalletDatabase());
10601060
wallet->LoadWallet();
10611061
LOCK(wallet->cs_wallet);
10621062
wallet->SetWalletFlag(WALLET_FLAG_DESCRIPTORS);
10631063
wallet->SetupDescriptorScriptPubKeyMans();
10641064

10651065
CoinsResult available_coins;
10661066
{
1067-
std::unique_ptr<CWallet> dummyWallet = std::make_unique<CWallet>(m_node.chain.get(), "dummy", m_args, CreateMockWalletDatabase());
1067+
std::unique_ptr<CWallet> dummyWallet = std::make_unique<CWallet>(m_node.chain.get(), "dummy", CreateMockWalletDatabase());
10681068
dummyWallet->LoadWallet();
10691069
LOCK(dummyWallet->cs_wallet);
10701070
dummyWallet->SetWalletFlag(WALLET_FLAG_DESCRIPTORS);
@@ -1105,7 +1105,7 @@ BOOST_FIXTURE_TEST_CASE(wallet_coinsresult_test, BasicTestingSetup)
11051105
// Test case to verify CoinsResult object sanity.
11061106
CoinsResult available_coins;
11071107
{
1108-
std::unique_ptr<CWallet> dummyWallet = std::make_unique<CWallet>(m_node.chain.get(), "dummy", m_args, CreateMockWalletDatabase());
1108+
std::unique_ptr<CWallet> dummyWallet = std::make_unique<CWallet>(m_node.chain.get(), "dummy", CreateMockWalletDatabase());
11091109
BOOST_CHECK_EQUAL(dummyWallet->LoadWallet(), DBErrors::LOAD_OK);
11101110
LOCK(dummyWallet->cs_wallet);
11111111
dummyWallet->SetWalletFlag(WALLET_FLAG_DESCRIPTORS);

0 commit comments

Comments
 (0)