From 0576f3ef732a6e201a5cab716530a36c32bb27db Mon Sep 17 00:00:00 2001 From: Lev Berman Date: Thu, 20 Sep 2018 12:34:08 +0200 Subject: [PATCH] Clarify the conclusion order in Election.process_blocks. --- bigchaindb/elections/election.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/bigchaindb/elections/election.py b/bigchaindb/elections/election.py index e4e783b2..df122f64 100644 --- a/bigchaindb/elections/election.py +++ b/bigchaindb/elections/election.py @@ -200,14 +200,13 @@ class Election(Transaction): Custom elections may override this function and introduce additional checks. """ + if self.has_validator_set_changed(bigchain): + return False election_pk = self.to_public_key(self.id) votes_committed = self.get_commited_votes(bigchain, election_pk) votes_current = self.count_votes(election_pk, current_votes) - if self.has_validator_set_changed(bigchain): - return False - current_validators = self.get_validators(bigchain) total_votes = sum(current_validators.values()) if (votes_committed < (2/3) * total_votes) and \ @@ -266,7 +265,8 @@ class Election(Transaction): marked as such. Elections and votes are processed in the order in which they - appear in the block. + appear in the block. Elections are concluded in the order of + appearance of their first votes in the block. For every election concluded in the block, calls its `on_approval` method. The returned value of the last `on_approval`, if any,