@@ -334,32 +334,31 @@ BOOST_FIXTURE_TEST_CASE(importwallet_rescan, TestChain100Setup)
334
334
// concurrently, ensuring no race conditions occur during either process.
335
335
BOOST_FIXTURE_TEST_CASE (write_wallet_settings_concurrently, TestingSetup)
336
336
{
337
- WalletContext context;
338
- context.chain = m_node.chain .get ();
337
+ auto chain = m_node.chain .get ();
339
338
const auto NUM_WALLETS{5 };
340
339
341
340
// 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 ());
343
342
344
343
const auto & check_concurrent_wallet = [&](const auto & settings_function, int num_expected_wallets) {
345
344
std::vector<std::thread> threads;
346
345
threads.reserve (NUM_WALLETS);
347
346
for (auto i{0 }; i < NUM_WALLETS; ++i) threads.emplace_back (settings_function, i);
348
347
for (auto & t : threads) t.join ();
349
348
350
- auto wallets = context. chain ->getRwSetting (" wallet" );
349
+ auto wallets = chain->getRwSetting (" wallet" );
351
350
BOOST_CHECK_EQUAL (wallets.getValues ().size (), num_expected_wallets);
352
351
};
353
352
354
353
// 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)));
357
356
},
358
357
/* num_expected_wallets=*/ NUM_WALLETS);
359
358
360
359
// 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)));
363
362
},
364
363
/* num_expected_wallets=*/ 0 );
365
364
}
0 commit comments