diff --git a/nano/core_test/node.cpp b/nano/core_test/node.cpp index ecb8ec3e..d9120f7f 100644 --- a/nano/core_test/node.cpp +++ b/nano/core_test/node.cpp @@ -1757,23 +1757,20 @@ TEST (node, rep_self_vote) ASSERT_EQ (nano::process_result::progress, node0->process (*block0).code); auto & active (node0->active); active.start (block0); - nano::unique_lock lock (active.mutex); - auto existing (active.roots.find (block0->qualified_root ())); - ASSERT_NE (active.roots.end (), existing); - auto election (existing->election); - lock.unlock (); + std::shared_ptr election; + { + nano::unique_lock lock (active.mutex); + auto existing (active.roots.find (block0->qualified_root ())); + ASSERT_NE (active.roots.end (), existing); + election = existing->election; + } + node0->block_processor.generator.add (block0->hash ()); system.deadline_set (1s); // Wait until representatives are activated & make vote while (election->last_votes_size () != 3) { - lock.lock (); - auto transaction (node0->store.tx_begin_read ()); - election->compute_rep_votes (transaction); - lock.unlock (); - node0->vote_processor.flush (); ASSERT_NO_ERROR (system.poll ()); } - lock.lock (); auto & rep_votes (election->last_votes); ASSERT_NE (rep_votes.end (), rep_votes.find (nano::test_genesis_key.pub)); ASSERT_NE (rep_votes.end (), rep_votes.find (rep_big.pub)); diff --git a/nano/node/election.cpp b/nano/node/election.cpp index 9944f226..fcc53849 100644 --- a/nano/node/election.cpp +++ b/nano/node/election.cpp @@ -23,17 +23,6 @@ stopped (false) update_dependent (); } -void nano::election::compute_rep_votes (nano::transaction const & transaction_a) -{ - if (node.config.enable_voting) - { - node.wallets.foreach_representative ([this, &transaction_a](nano::public_key const & pub_a, nano::raw_key const & prv_a) { - auto vote (this->node.store.vote_generate (transaction_a, pub_a, prv_a, status.winner)); - this->node.vote_processor.vote (vote, std::make_shared (this->node.network.udp_channels, this->node.network.endpoint (), this->node.network_params.protocol.protocol_version)); - }); - } -} - void nano::election::confirm_once (nano::election_status_type type_a) { assert (!node.active.mutex.try_lock ()); diff --git a/nano/node/election.hpp b/nano/node/election.hpp index 85581c01..6884451f 100644 --- a/nano/node/election.hpp +++ b/nano/node/election.hpp @@ -39,8 +39,6 @@ public: nano::tally_t tally (); // Check if we have vote quorum bool have_quorum (nano::tally_t const &, nano::uint128_t) const; - // Change our winner to agree with the network - void compute_rep_votes (nano::transaction const &); void confirm_once (nano::election_status_type = nano::election_status_type::active_confirmed_quorum); // Confirm this block if quorum is met void confirm_if_quorum ();