Fix election calling confirm_if_quorum after destruction (#2563)

When insert_inactive_votes_cache confirms the election it deletes itself from the active roots, causing the next confirm_if_quorum call to access freed memory.
This commit is contained in:
Guilherme Lawless 2020-02-17 15:54:11 +00:00 committed by GitHub
commit ec886e7bb0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -220,7 +220,6 @@ bool nano::election::publish (std::shared_ptr<nano::block> block_a)
{
blocks.emplace (std::make_pair (block_a->hash (), block_a));
insert_inactive_votes_cache (block_a->hash ());
confirm_if_quorum ();
node.network.flood_block (block_a, false);
}
else