Clarify the conclusion order in Election.process_blocks.

This commit is contained in:
Lev Berman 2018-09-20 12:34:08 +02:00
parent 4a96216356
commit 0576f3ef73

View File

@ -200,14 +200,13 @@ class Election(Transaction):
Custom elections may override this function and introduce additional checks. 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) election_pk = self.to_public_key(self.id)
votes_committed = self.get_commited_votes(bigchain, election_pk) votes_committed = self.get_commited_votes(bigchain, election_pk)
votes_current = self.count_votes(election_pk, current_votes) votes_current = self.count_votes(election_pk, current_votes)
if self.has_validator_set_changed(bigchain):
return False
current_validators = self.get_validators(bigchain) current_validators = self.get_validators(bigchain)
total_votes = sum(current_validators.values()) total_votes = sum(current_validators.values())
if (votes_committed < (2/3) * total_votes) and \ if (votes_committed < (2/3) * total_votes) and \
@ -266,7 +265,8 @@ class Election(Transaction):
marked as such. marked as such.
Elections and votes are processed in the order in which they 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` For every election concluded in the block, calls its `on_approval`
method. The returned value of the last `on_approval`, if any, method. The returned value of the last `on_approval`, if any,