Skip to content

Commit

Permalink
Add missing should_update_winner parameter to confirm_if_quorum
Browse files Browse the repository at this point in the history
  • Loading branch information
PlasmaPower committed Aug 24, 2018
1 parent fd00807 commit 46062ea
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 3 additions & 3 deletions rai/node/node.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4956,7 +4956,7 @@ rai::tally_t rai::election::tally (MDB_txn * transaction_a)
return result;
}

void rai::election::confirm_if_quorum (MDB_txn * transaction_a)
void rai::election::confirm_if_quorum (MDB_txn * transaction_a, bool should_update_winner)
{
auto tally_l (tally (transaction_a));
assert (tally_l.size () > 0);
Expand All @@ -4968,7 +4968,7 @@ void rai::election::confirm_if_quorum (MDB_txn * transaction_a)
{
sum += i.first;
}
if (sum >= node.config.online_weight_minimum.number () && !(*block_l == *status.winner))
if (sum >= node.config.online_weight_minimum.number () && !(*block_l == *status.winner) && should_update_winner)
{
auto node_l (node.shared ());
node_l->block_processor.force (block_l);
Expand Down Expand Up @@ -5276,7 +5276,7 @@ bool rai::active_transactions::start (std::pair<std::shared_ptr<rai::block>, std
if (existing == roots.end ())
{
auto election (std::make_shared<rai::election> (node, primary_block, confirmation_action_a));
election->should_update_winner = vote_stapled_block; // If we have a vote stapled block, keep winner for an election
election->should_update_winner = (bool)vote_stapled_block; // If we have a vote stapled block, keep winner for an election
roots.insert (rai::conflict_info{ root, election, 0, blocks_a });
successors.insert (std::make_pair (primary_block->hash (), election));
}
Expand Down
2 changes: 1 addition & 1 deletion rai/node/node.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ class election : public std::enable_shared_from_this<rai::election>
// Change our winner to agree with the network
void compute_rep_votes (MDB_txn *);
// Confirm this block if quorum is met
void confirm_if_quorum (MDB_txn *);
void confirm_if_quorum (MDB_txn *, bool);
void log_votes (rai::tally_t const &);
bool publish (std::shared_ptr<rai::block> block_a);
void abort ();
Expand Down

0 comments on commit 46062ea

Please sign in to comment.