diff options
author | Russell Yanofsky <russ@yanofsky.org> | 2020-01-16 16:42:01 -0500 |
---|---|---|
committer | Russell Yanofsky <russ@yanofsky.org> | 2020-03-31 08:36:02 -0500 |
commit | 25a9fcf9e53bfa94e8f8b19a4abfda0f444f6b2a (patch) | |
tree | a462484a0d380feb2eefce418276a002b60daa2a /src/wallet/test/wallet_tests.cpp | |
parent | c1694ce6bb7e19a8722d5583cd85ad17da40bb67 (diff) | |
download | bitcoin-25a9fcf9e53bfa94e8f8b19a4abfda0f444f6b2a.tar.xz |
wallet: Avoid use of Chain::Lock in importwallet and dumpwallet
This is a step toward removing the Chain::Lock class and reducing cs_main
locking.
This change only affects behavior in the case where wallet last block processed
falls behind the chain tip, in which case it will use more accurate backup and
rescan timestamps.
Diffstat (limited to 'src/wallet/test/wallet_tests.cpp')
-rw-r--r-- | src/wallet/test/wallet_tests.cpp | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/src/wallet/test/wallet_tests.cpp b/src/wallet/test/wallet_tests.cpp index a487e9e2e0..f333b09ad9 100644 --- a/src/wallet/test/wallet_tests.cpp +++ b/src/wallet/test/wallet_tests.cpp @@ -225,6 +225,7 @@ BOOST_FIXTURE_TEST_CASE(importwallet_rescan, TestChain100Setup) request.params.setArray(); request.params.push_back(backup_file); AddWallet(wallet); + wallet->SetLastBlockProcessed(::ChainActive().Height(), ::ChainActive().Tip()->GetBlockHash()); ::dumpwallet(request); RemoveWallet(wallet); } @@ -233,16 +234,17 @@ BOOST_FIXTURE_TEST_CASE(importwallet_rescan, TestChain100Setup) // were scanned, and no prior blocks were scanned. { std::shared_ptr<CWallet> wallet = std::make_shared<CWallet>(chain.get(), WalletLocation(), WalletDatabase::CreateDummy()); + LOCK(wallet->cs_wallet); wallet->SetupLegacyScriptPubKeyMan(); JSONRPCRequest request; request.params.setArray(); request.params.push_back(backup_file); AddWallet(wallet); + wallet->SetLastBlockProcessed(::ChainActive().Height(), ::ChainActive().Tip()->GetBlockHash()); ::importwallet(request); RemoveWallet(wallet); - LOCK(wallet->cs_wallet); BOOST_CHECK_EQUAL(wallet->mapWallet.size(), 3U); BOOST_CHECK_EQUAL(m_coinbase_txns.size(), 103U); for (size_t i = 0; i < m_coinbase_txns.size(); ++i) { |