Skip to content

Commit d7b9045

Browse files
committed
Remove gArgs from wallet.h and wallet.cpp
1 parent 06a624e commit d7b9045

15 files changed

+58
-54
lines changed

src/bench/coin_selection.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ static void CoinSelection(benchmark::Bench& bench)
3232
{
3333
NodeContext node;
3434
auto chain = interfaces::MakeChain(node);
35-
CWallet wallet(chain.get(), "", CreateDummyWalletDatabase());
35+
CWallet wallet(chain.get(), "", gArgs, CreateDummyWalletDatabase());
3636
wallet.SetupLegacyScriptPubKeyMan();
3737
std::vector<std::unique_ptr<CWalletTx>> wtxs;
3838
LOCK(wallet.cs_wallet);
@@ -67,7 +67,7 @@ static void CoinSelection(benchmark::Bench& bench)
6767
typedef std::set<CInputCoin> CoinSet;
6868
static NodeContext testNode;
6969
static auto testChain = interfaces::MakeChain(testNode);
70-
static CWallet testWallet(testChain.get(), "", CreateDummyWalletDatabase());
70+
static CWallet testWallet(testChain.get(), "", gArgs, CreateDummyWalletDatabase());
7171
std::vector<std::unique_ptr<CWalletTx>> wtxn;
7272

7373
// Copied from src/wallet/test/coinselector_tests.cpp

src/bench/wallet_balance.cpp

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

2121
const auto& ADDRESS_WATCHONLY = ADDRESS_BCRT1_UNSPENDABLE;
2222

23-
CWallet wallet{test_setup->m_node.chain.get(), "", CreateMockWalletDatabase()};
23+
CWallet wallet{test_setup->m_node.chain.get(), "", gArgs, CreateMockWalletDatabase()};
2424
{
2525
wallet.SetupLegacyScriptPubKeyMan();
2626
if (wallet.LoadWallet() != DBErrors::LOAD_OK) assert(false);

src/qt/test/addressbooktests.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ void TestAddAddressesToSendBook(interfaces::Node& node)
6161
{
6262
TestChain100Setup test;
6363
node.setContext(&test.m_node);
64-
std::shared_ptr<CWallet> wallet = std::make_shared<CWallet>(node.context()->chain.get(), "", CreateMockWalletDatabase());
64+
std::shared_ptr<CWallet> wallet = std::make_shared<CWallet>(node.context()->chain.get(), "", gArgs, CreateMockWalletDatabase());
6565
wallet->SetupLegacyScriptPubKeyMan();
6666
wallet->LoadWallet();
6767

src/qt/test/wallettests.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ void TestGUI(interfaces::Node& node)
139139
test.CreateAndProcessBlock({}, GetScriptForRawPubKey(test.coinbaseKey.GetPubKey()));
140140
}
141141
node.setContext(&test.m_node);
142-
std::shared_ptr<CWallet> wallet = std::make_shared<CWallet>(node.context()->chain.get(), "", CreateMockWalletDatabase());
142+
std::shared_ptr<CWallet> wallet = std::make_shared<CWallet>(node.context()->chain.get(), "", gArgs, CreateMockWalletDatabase());
143143
wallet->LoadWallet();
144144
{
145145
auto spk_man = wallet->GetOrCreateLegacyScriptPubKeyMan();

src/wallet/dump.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -191,7 +191,7 @@ bool CreateFromDump(const std::string& name, const fs::path& wallet_path, biling
191191

192192
// dummy chain interface
193193
bool ret = true;
194-
std::shared_ptr<CWallet> wallet(new CWallet(nullptr /* chain */, name, std::move(database)), WalletToolReleaseWallet);
194+
std::shared_ptr<CWallet> wallet(new CWallet(nullptr /* chain */, name, gArgs, std::move(database)), WalletToolReleaseWallet);
195195
{
196196
LOCK(wallet->cs_wallet);
197197
DBErrors load_wallet_ret = wallet->LoadWallet();

src/wallet/salvage.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ bool RecoverDatabaseFile(const fs::path& file_path, bilingual_str& error, std::v
133133
}
134134

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

src/wallet/test/coinselector_tests.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ typedef std::set<CInputCoin> CoinSet;
3131
static std::vector<COutput> vCoins;
3232
static NodeContext testNode;
3333
static auto testChain = interfaces::MakeChain(testNode);
34-
static CWallet testWallet(testChain.get(), "", CreateDummyWalletDatabase());
34+
static CWallet testWallet(testChain.get(), "", gArgs, CreateDummyWalletDatabase());
3535
static CAmount balance = 0;
3636

3737
CoinEligibilityFilter filter_standard(1, 6, 0);
@@ -306,7 +306,7 @@ BOOST_AUTO_TEST_CASE(bnb_search_test)
306306
// Make sure that can use BnB when there are preset inputs
307307
empty_wallet();
308308
{
309-
std::unique_ptr<CWallet> wallet = std::make_unique<CWallet>(m_node.chain.get(), "", CreateMockWalletDatabase());
309+
std::unique_ptr<CWallet> wallet = std::make_unique<CWallet>(m_node.chain.get(), "", gArgs, CreateMockWalletDatabase());
310310
wallet->LoadWallet();
311311
wallet->SetupLegacyScriptPubKeyMan();
312312
LOCK(wallet->cs_wallet);

src/wallet/test/ismine_tests.cpp

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ BOOST_AUTO_TEST_CASE(ismine_standard)
3434

3535
// P2PK compressed
3636
{
37-
CWallet keystore(chain.get(), "", CreateDummyWalletDatabase());
37+
CWallet keystore(chain.get(), "", gArgs, CreateDummyWalletDatabase());
3838
keystore.SetupLegacyScriptPubKeyMan();
3939
LOCK(keystore.GetLegacyScriptPubKeyMan()->cs_KeyStore);
4040
scriptPubKey = GetScriptForRawPubKey(pubkeys[0]);
@@ -51,7 +51,7 @@ BOOST_AUTO_TEST_CASE(ismine_standard)
5151

5252
// P2PK uncompressed
5353
{
54-
CWallet keystore(chain.get(), "", CreateDummyWalletDatabase());
54+
CWallet keystore(chain.get(), "", gArgs, CreateDummyWalletDatabase());
5555
keystore.SetupLegacyScriptPubKeyMan();
5656
LOCK(keystore.GetLegacyScriptPubKeyMan()->cs_KeyStore);
5757
scriptPubKey = GetScriptForRawPubKey(uncompressedPubkey);
@@ -68,7 +68,7 @@ BOOST_AUTO_TEST_CASE(ismine_standard)
6868

6969
// P2PKH compressed
7070
{
71-
CWallet keystore(chain.get(), "", CreateDummyWalletDatabase());
71+
CWallet keystore(chain.get(), "", gArgs, CreateDummyWalletDatabase());
7272
keystore.SetupLegacyScriptPubKeyMan();
7373
LOCK(keystore.GetLegacyScriptPubKeyMan()->cs_KeyStore);
7474
scriptPubKey = GetScriptForDestination(PKHash(pubkeys[0]));
@@ -85,7 +85,7 @@ BOOST_AUTO_TEST_CASE(ismine_standard)
8585

8686
// P2PKH uncompressed
8787
{
88-
CWallet keystore(chain.get(), "", CreateDummyWalletDatabase());
88+
CWallet keystore(chain.get(), "", gArgs, CreateDummyWalletDatabase());
8989
keystore.SetupLegacyScriptPubKeyMan();
9090
LOCK(keystore.GetLegacyScriptPubKeyMan()->cs_KeyStore);
9191
scriptPubKey = GetScriptForDestination(PKHash(uncompressedPubkey));
@@ -102,7 +102,7 @@ BOOST_AUTO_TEST_CASE(ismine_standard)
102102

103103
// P2SH
104104
{
105-
CWallet keystore(chain.get(), "", CreateDummyWalletDatabase());
105+
CWallet keystore(chain.get(), "", gArgs, CreateDummyWalletDatabase());
106106
keystore.SetupLegacyScriptPubKeyMan();
107107
LOCK(keystore.GetLegacyScriptPubKeyMan()->cs_KeyStore);
108108

@@ -126,7 +126,7 @@ BOOST_AUTO_TEST_CASE(ismine_standard)
126126

127127
// (P2PKH inside) P2SH inside P2SH (invalid)
128128
{
129-
CWallet keystore(chain.get(), "", CreateDummyWalletDatabase());
129+
CWallet keystore(chain.get(), "", gArgs, CreateDummyWalletDatabase());
130130
keystore.SetupLegacyScriptPubKeyMan();
131131
LOCK(keystore.GetLegacyScriptPubKeyMan()->cs_KeyStore);
132132

@@ -144,7 +144,7 @@ BOOST_AUTO_TEST_CASE(ismine_standard)
144144

145145
// (P2PKH inside) P2SH inside P2WSH (invalid)
146146
{
147-
CWallet keystore(chain.get(), "", CreateDummyWalletDatabase());
147+
CWallet keystore(chain.get(), "", gArgs, CreateDummyWalletDatabase());
148148
keystore.SetupLegacyScriptPubKeyMan();
149149
LOCK(keystore.GetLegacyScriptPubKeyMan()->cs_KeyStore);
150150

@@ -162,7 +162,7 @@ BOOST_AUTO_TEST_CASE(ismine_standard)
162162

163163
// P2WPKH inside P2WSH (invalid)
164164
{
165-
CWallet keystore(chain.get(), "", CreateDummyWalletDatabase());
165+
CWallet keystore(chain.get(), "", gArgs, CreateDummyWalletDatabase());
166166
keystore.SetupLegacyScriptPubKeyMan();
167167
LOCK(keystore.GetLegacyScriptPubKeyMan()->cs_KeyStore);
168168

@@ -178,7 +178,7 @@ BOOST_AUTO_TEST_CASE(ismine_standard)
178178

179179
// (P2PKH inside) P2WSH inside P2WSH (invalid)
180180
{
181-
CWallet keystore(chain.get(), "", CreateDummyWalletDatabase());
181+
CWallet keystore(chain.get(), "", gArgs, CreateDummyWalletDatabase());
182182
keystore.SetupLegacyScriptPubKeyMan();
183183
LOCK(keystore.GetLegacyScriptPubKeyMan()->cs_KeyStore);
184184

@@ -196,7 +196,7 @@ BOOST_AUTO_TEST_CASE(ismine_standard)
196196

197197
// P2WPKH compressed
198198
{
199-
CWallet keystore(chain.get(), "", CreateDummyWalletDatabase());
199+
CWallet keystore(chain.get(), "", gArgs, CreateDummyWalletDatabase());
200200
keystore.SetupLegacyScriptPubKeyMan();
201201
LOCK(keystore.GetLegacyScriptPubKeyMan()->cs_KeyStore);
202202
BOOST_CHECK(keystore.GetLegacyScriptPubKeyMan()->AddKey(keys[0]));
@@ -211,7 +211,7 @@ BOOST_AUTO_TEST_CASE(ismine_standard)
211211

212212
// P2WPKH uncompressed
213213
{
214-
CWallet keystore(chain.get(), "", CreateDummyWalletDatabase());
214+
CWallet keystore(chain.get(), "", gArgs, CreateDummyWalletDatabase());
215215
keystore.SetupLegacyScriptPubKeyMan();
216216
LOCK(keystore.GetLegacyScriptPubKeyMan()->cs_KeyStore);
217217
BOOST_CHECK(keystore.GetLegacyScriptPubKeyMan()->AddKey(uncompressedKey));
@@ -230,7 +230,7 @@ BOOST_AUTO_TEST_CASE(ismine_standard)
230230

231231
// scriptPubKey multisig
232232
{
233-
CWallet keystore(chain.get(), "", CreateDummyWalletDatabase());
233+
CWallet keystore(chain.get(), "", gArgs, CreateDummyWalletDatabase());
234234
keystore.SetupLegacyScriptPubKeyMan();
235235
LOCK(keystore.GetLegacyScriptPubKeyMan()->cs_KeyStore);
236236

@@ -261,7 +261,7 @@ BOOST_AUTO_TEST_CASE(ismine_standard)
261261

262262
// P2SH multisig
263263
{
264-
CWallet keystore(chain.get(), "", CreateDummyWalletDatabase());
264+
CWallet keystore(chain.get(), "", gArgs, CreateDummyWalletDatabase());
265265
keystore.SetupLegacyScriptPubKeyMan();
266266
LOCK(keystore.GetLegacyScriptPubKeyMan()->cs_KeyStore);
267267
BOOST_CHECK(keystore.GetLegacyScriptPubKeyMan()->AddKey(uncompressedKey));
@@ -282,7 +282,7 @@ BOOST_AUTO_TEST_CASE(ismine_standard)
282282

283283
// P2WSH multisig with compressed keys
284284
{
285-
CWallet keystore(chain.get(), "", CreateDummyWalletDatabase());
285+
CWallet keystore(chain.get(), "", gArgs, CreateDummyWalletDatabase());
286286
keystore.SetupLegacyScriptPubKeyMan();
287287
LOCK(keystore.GetLegacyScriptPubKeyMan()->cs_KeyStore);
288288
BOOST_CHECK(keystore.GetLegacyScriptPubKeyMan()->AddKey(keys[0]));
@@ -308,7 +308,7 @@ BOOST_AUTO_TEST_CASE(ismine_standard)
308308

309309
// P2WSH multisig with uncompressed key
310310
{
311-
CWallet keystore(chain.get(), "", CreateDummyWalletDatabase());
311+
CWallet keystore(chain.get(), "", gArgs, CreateDummyWalletDatabase());
312312
keystore.SetupLegacyScriptPubKeyMan();
313313
LOCK(keystore.GetLegacyScriptPubKeyMan()->cs_KeyStore);
314314
BOOST_CHECK(keystore.GetLegacyScriptPubKeyMan()->AddKey(uncompressedKey));
@@ -334,7 +334,7 @@ BOOST_AUTO_TEST_CASE(ismine_standard)
334334

335335
// P2WSH multisig wrapped in P2SH
336336
{
337-
CWallet keystore(chain.get(), "", CreateDummyWalletDatabase());
337+
CWallet keystore(chain.get(), "", gArgs, CreateDummyWalletDatabase());
338338
keystore.SetupLegacyScriptPubKeyMan();
339339
LOCK(keystore.GetLegacyScriptPubKeyMan()->cs_KeyStore);
340340

@@ -361,7 +361,7 @@ BOOST_AUTO_TEST_CASE(ismine_standard)
361361

362362
// OP_RETURN
363363
{
364-
CWallet keystore(chain.get(), "", CreateDummyWalletDatabase());
364+
CWallet keystore(chain.get(), "", gArgs, CreateDummyWalletDatabase());
365365
keystore.SetupLegacyScriptPubKeyMan();
366366
LOCK(keystore.GetLegacyScriptPubKeyMan()->cs_KeyStore);
367367
BOOST_CHECK(keystore.GetLegacyScriptPubKeyMan()->AddKey(keys[0]));
@@ -375,7 +375,7 @@ BOOST_AUTO_TEST_CASE(ismine_standard)
375375

376376
// witness unspendable
377377
{
378-
CWallet keystore(chain.get(), "", CreateDummyWalletDatabase());
378+
CWallet keystore(chain.get(), "", gArgs, CreateDummyWalletDatabase());
379379
keystore.SetupLegacyScriptPubKeyMan();
380380
LOCK(keystore.GetLegacyScriptPubKeyMan()->cs_KeyStore);
381381
BOOST_CHECK(keystore.GetLegacyScriptPubKeyMan()->AddKey(keys[0]));
@@ -389,7 +389,7 @@ BOOST_AUTO_TEST_CASE(ismine_standard)
389389

390390
// witness unknown
391391
{
392-
CWallet keystore(chain.get(), "", CreateDummyWalletDatabase());
392+
CWallet keystore(chain.get(), "", gArgs, CreateDummyWalletDatabase());
393393
keystore.SetupLegacyScriptPubKeyMan();
394394
LOCK(keystore.GetLegacyScriptPubKeyMan()->cs_KeyStore);
395395
BOOST_CHECK(keystore.GetLegacyScriptPubKeyMan()->AddKey(keys[0]));
@@ -403,7 +403,7 @@ BOOST_AUTO_TEST_CASE(ismine_standard)
403403

404404
// Nonstandard
405405
{
406-
CWallet keystore(chain.get(), "", CreateDummyWalletDatabase());
406+
CWallet keystore(chain.get(), "", gArgs, CreateDummyWalletDatabase());
407407
keystore.SetupLegacyScriptPubKeyMan();
408408
LOCK(keystore.GetLegacyScriptPubKeyMan()->cs_KeyStore);
409409
BOOST_CHECK(keystore.GetLegacyScriptPubKeyMan()->AddKey(keys[0]));

src/wallet/test/scriptpubkeyman_tests.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ BOOST_FIXTURE_TEST_SUITE(scriptpubkeyman_tests, BasicTestingSetup)
1717
BOOST_AUTO_TEST_CASE(CanProvide)
1818
{
1919
// Set up wallet and keyman variables.
20-
CWallet wallet(m_node.chain.get(), "", CreateDummyWalletDatabase());
20+
CWallet wallet(m_node.chain.get(), "", gArgs, CreateDummyWalletDatabase());
2121
LegacyScriptPubKeyMan& keyman = *wallet.GetOrCreateLegacyScriptPubKeyMan();
2222

2323
// Make a 1 of 2 multisig script

src/wallet/test/util.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616

1717
std::unique_ptr<CWallet> CreateSyncedWallet(interfaces::Chain& chain, CChain& cchain, const CKey& key)
1818
{
19-
auto wallet = std::make_unique<CWallet>(&chain, "", CreateMockWalletDatabase());
19+
auto wallet = std::make_unique<CWallet>(&chain, "", gArgs, CreateMockWalletDatabase());
2020
{
2121
LOCK2(wallet->cs_wallet, ::cs_main);
2222
wallet->SetLastBlockProcessed(cchain.Height(), cchain.Tip()->GetBlockHash());

0 commit comments

Comments
 (0)