Don't use active transactions mutex lock during confirmation solicitor.prepare () (#2602)

This commit is contained in:
Sergey Kroshnin 2020-02-27 01:55:49 +03:00 committed by GitHub
commit b3d99225f9
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -277,6 +277,12 @@ void nano::active_transactions::request_confirm (nano::unique_lock<std::mutex> &
lock_a.lock ();
}
}
// Only representatives ready to receive batched confirm_req
lock_a.unlock ();
solicitor.prepare (node.rep_crawler.representatives (node.network_params.protocol.tcp_realtime_protocol_version_min));
lock_a.lock ();
auto const now (std::chrono::steady_clock::now ());
// Any new election started from process_live only gets requests after at least 1 second
auto cutoff_l (now - election_request_delay);
@ -293,9 +299,6 @@ void nano::active_transactions::request_confirm (nano::unique_lock<std::mutex> &
auto & sorted_roots_l = roots.get<tag_difficulty> ();
size_t count_l{ 0 };
// Only representatives ready to receive batched confirm_req
solicitor.prepare (node.rep_crawler.representatives (node.network_params.protocol.tcp_realtime_protocol_version_min));
/*
* Loop through active elections in descending order of proof-of-work difficulty, requesting confirmation
*