Remove unused function (#2453)
* Rewriting test to use standard vote generation process. * Removing unused function.
This commit is contained in:
parent
0d90226391
commit
f853d3d856
3 changed files with 8 additions and 24 deletions
|
@ -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<std::mutex> 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<nano::election> election;
|
||||
{
|
||||
nano::unique_lock<std::mutex> 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));
|
||||
|
|
|
@ -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<nano::transport::channel_udp> (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 ());
|
||||
|
|
|
@ -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 ();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue