tsan: fix race in inactive_votes_cache_multiple_votes (#2334)
This commit is contained in:
parent
2d4a1ff72d
commit
a0b4977531
3 changed files with 12 additions and 4 deletions
|
@ -499,8 +499,15 @@ TEST (active_transactions, inactive_votes_cache_multiple_votes)
|
|||
auto vote2 (std::make_shared<nano::vote> (nano::test_genesis_key.pub, nano::test_genesis_key.prv, 0, std::vector<nano::block_hash> (1, send1->hash ())));
|
||||
system.nodes[0]->vote_processor.vote (vote2, std::make_shared<nano::transport::channel_udp> (system.nodes[0]->network.udp_channels, system.nodes[0]->network.endpoint (), system.nodes[0]->network_params.protocol.protocol_version));
|
||||
system.deadline_set (5s);
|
||||
while (system.nodes[0]->active.find_inactive_votes_cache (send1->hash ()).voters.size () != 2)
|
||||
while (true)
|
||||
{
|
||||
{
|
||||
nano::lock_guard<std::mutex> active_guard (system.nodes[0]->active.mutex);
|
||||
if (system.nodes[0]->active.find_inactive_votes_cache (send1->hash ()).voters.size () == 2)
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
ASSERT_NO_ERROR (system.poll ());
|
||||
}
|
||||
ASSERT_EQ (1, system.nodes[0]->active.inactive_votes_cache_size ());
|
||||
|
|
|
@ -333,7 +333,8 @@ void nano::active_transactions::request_confirm (nano::unique_lock<std::mutex> &
|
|||
// Batched confirmation requests
|
||||
if (!batched_confirm_req_bundle_l.empty ())
|
||||
{
|
||||
node.network.broadcast_confirm_req_batched_many (batched_confirm_req_bundle_l, [this]() {
|
||||
node.network.broadcast_confirm_req_batched_many (
|
||||
batched_confirm_req_bundle_l, [this]() {
|
||||
{
|
||||
nano::lock_guard<std::mutex> guard_l (this->mutex);
|
||||
--this->ongoing_broadcasts;
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
#include <nano/secure/versioning.hpp>
|
||||
|
||||
#include <lmdb/libraries/liblmdb/lmdb.h>
|
||||
|
||||
#include <boost/endian/conversion.hpp>
|
||||
|
||||
#include <lmdb/libraries/liblmdb/lmdb.h>
|
||||
|
||||
nano::account_info_v1::account_info_v1 (MDB_val const & val_a)
|
||||
{
|
||||
assert (val_a.mv_size == sizeof (*this));
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue