Modify inactive cache conditions to prevent multiple insertions for confirmed entries (#2674)

This commit is contained in:
Sergey Kroshnin 2020-03-24 13:58:00 +03:00 committed by GitHub
commit 8382d4ad03
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -939,7 +939,9 @@ void nano::active_transactions::add_inactive_votes_cache (nano::block_hash const
{
auto & inactive_by_hash (inactive_votes_cache.get<tag_hash> ());
auto existing (inactive_by_hash.find (hash_a));
if (existing != inactive_by_hash.end () && (!existing->confirmed || !existing->bootstrap_started))
if (existing != inactive_by_hash.end ())
{
if (!existing->confirmed || !existing->bootstrap_started)
{
auto is_new (false);
inactive_by_hash.modify (existing, [representative_a, &is_new](nano::inactive_cache_information & info) {
@ -969,6 +971,7 @@ void nano::active_transactions::add_inactive_votes_cache (nano::block_hash const
}
}
}
}
else
{
std::vector<nano::account> representative_vector (1, representative_a);