diff options
author | moneromooo-monero <moneromooo-monero@users.noreply.github.com> | 2018-12-16 01:24:46 +0000 |
---|---|---|
committer | moneromooo-monero <moneromooo-monero@users.noreply.github.com> | 2018-12-16 18:31:10 +0000 |
commit | 808a1f1e8aeffedf24d2cf52b5d3e20e0b96efaa (patch) | |
tree | bf5cab0fa2f19df5ddf76a4a885c61570fc07e24 /src | |
parent | Merge pull request #4927 (diff) | |
download | monero-808a1f1e8aeffedf24d2cf52b5d3e20e0b96efaa.tar.xz |
wallet2: cut down on the number of useless derivation threads
Diffstat (limited to 'src')
-rw-r--r-- | src/wallet/wallet2.cpp | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/src/wallet/wallet2.cpp b/src/wallet/wallet2.cpp index 097278961..5e43420dd 100644 --- a/src/wallet/wallet2.cpp +++ b/src/wallet/wallet2.cpp @@ -2151,7 +2151,6 @@ void wallet2::process_parsed_blocks(uint64_t start_height, const std::vector<cry const cryptonote::account_keys &keys = m_account.get_keys(); auto gender = [&](wallet2::is_out_data &iod) { - boost::unique_lock<hw::device> hwdev_lock(hwdev); if (!hwdev.generate_key_derivation(iod.pkey, keys.m_view_secret_key, iod.derivation)) { MWARNING("Failed to generate key derivation from tx pubkey, skipping"); @@ -2160,12 +2159,16 @@ void wallet2::process_parsed_blocks(uint64_t start_height, const std::vector<cry } }; - for (auto &slot: tx_cache_data) + for (size_t i = 0; i < tx_cache_data.size(); ++i) { - for (auto &iod: slot.primary) - tpool.submit(&waiter, [&gender, &iod]() { gender(iod); }, true); - for (auto &iod: slot.additional) - tpool.submit(&waiter, [&gender, &iod]() { gender(iod); }, true); + tpool.submit(&waiter, [&hwdev, &gender, &tx_cache_data, i]() { + auto &slot = tx_cache_data[i]; + boost::unique_lock<hw::device> hwdev_lock(hwdev); + for (auto &iod: slot.primary) + gender(iod); + for (auto &iod: slot.additional) + gender(iod); + }, true); } waiter.wait(&tpool); |