Retrieve copy of wallets in scan_receivable (#2934)
Locking the wallets items mutex
This commit is contained in:
parent
97afc803b3
commit
e8c3f89fc6
3 changed files with 8 additions and 2 deletions
|
@ -1178,9 +1178,8 @@ public:
|
|||
virtual ~confirmed_visitor () = default;
|
||||
void scan_receivable (nano::account const & account_a)
|
||||
{
|
||||
for (auto i (node.wallets.items.begin ()), n (node.wallets.items.end ()); i != n; ++i)
|
||||
for (auto const & [id /*unused*/, wallet] : node.wallets.get_wallets ())
|
||||
{
|
||||
auto const & wallet (i->second);
|
||||
auto transaction_l (node.wallets.tx_begin_read ());
|
||||
if (wallet->store.exists (transaction_l, account_a))
|
||||
{
|
||||
|
|
|
@ -1876,6 +1876,12 @@ void nano::wallets::move_table (std::string const & name_a, MDB_txn * tx_source,
|
|||
debug_assert (!error6);
|
||||
}
|
||||
|
||||
std::unordered_map<nano::wallet_id, std::shared_ptr<nano::wallet>> nano::wallets::get_wallets ()
|
||||
{
|
||||
nano::lock_guard<std::mutex> guard (mutex);
|
||||
return items;
|
||||
}
|
||||
|
||||
nano::uint128_t const nano::wallets::generate_priority = std::numeric_limits<nano::uint128_t>::max ();
|
||||
nano::uint128_t const nano::wallets::high_priority = std::numeric_limits<nano::uint128_t>::max () - 1;
|
||||
|
||||
|
|
|
@ -229,6 +229,7 @@ public:
|
|||
void ongoing_compute_reps ();
|
||||
void split_if_needed (nano::transaction &, nano::block_store &);
|
||||
void move_table (std::string const &, MDB_txn *, MDB_txn *);
|
||||
std::unordered_map<nano::wallet_id, std::shared_ptr<nano::wallet>> get_wallets ();
|
||||
nano::network_params network_params;
|
||||
std::function<void(bool)> observer;
|
||||
std::unordered_map<nano::wallet_id, std::shared_ptr<nano::wallet>> items;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue