Skip to content

Commit 1c40900

Browse files
committed
test: remove wallet context from write_wallet_settings_concurrently
1 parent a74bdee commit 1c40900

File tree

1 file changed

+7
-8
lines changed

1 file changed

+7
-8
lines changed

src/wallet/test/wallet_tests.cpp

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -334,32 +334,31 @@ BOOST_FIXTURE_TEST_CASE(importwallet_rescan, TestChain100Setup)
334334
// concurrently, ensuring no race conditions occur during either process.
335335
BOOST_FIXTURE_TEST_CASE(write_wallet_settings_concurrently, TestingSetup)
336336
{
337-
WalletContext context;
338-
context.chain = m_node.chain.get();
337+
auto chain = m_node.chain.get();
339338
const auto NUM_WALLETS{5};
340339

341340
// Since we're counting the number of wallets, ensure we start without any.
342-
BOOST_REQUIRE(context.chain->getRwSetting("wallet").isNull());
341+
BOOST_REQUIRE(chain->getRwSetting("wallet").isNull());
343342

344343
const auto& check_concurrent_wallet = [&](const auto& settings_function, int num_expected_wallets) {
345344
std::vector<std::thread> threads;
346345
threads.reserve(NUM_WALLETS);
347346
for (auto i{0}; i < NUM_WALLETS; ++i) threads.emplace_back(settings_function, i);
348347
for (auto& t : threads) t.join();
349348

350-
auto wallets = context.chain->getRwSetting("wallet");
349+
auto wallets = chain->getRwSetting("wallet");
351350
BOOST_CHECK_EQUAL(wallets.getValues().size(), num_expected_wallets);
352351
};
353352

354353
// Add NUM_WALLETS wallets concurrently, ensure we end up with NUM_WALLETS stored.
355-
check_concurrent_wallet([&context](int i) {
356-
Assert(AddWalletSetting(*context.chain, strprintf("wallet_%d", i)));
354+
check_concurrent_wallet([&chain](int i) {
355+
Assert(AddWalletSetting(*chain, strprintf("wallet_%d", i)));
357356
},
358357
/*num_expected_wallets=*/NUM_WALLETS);
359358

360359
// Remove NUM_WALLETS wallets concurrently, ensure we end up with 0 wallets.
361-
check_concurrent_wallet([&context](int i) {
362-
Assert(RemoveWalletSetting(*context.chain, strprintf("wallet_%d", i)));
360+
check_concurrent_wallet([&chain](int i) {
361+
Assert(RemoveWalletSetting(*chain, strprintf("wallet_%d", i)));
363362
},
364363
/*num_expected_wallets=*/0);
365364
}

0 commit comments

Comments
 (0)