mirror of
https://github.com/bigchaindb/bigchaindb.git
synced 2024-10-13 13:34:05 +00:00
Calculate total votes without making extra query.
This commit is contained in:
parent
8211fa916e
commit
4cd8ee2c97
@ -207,8 +207,7 @@ class Election(Transaction):
|
||||
votes_committed = self.get_commited_votes(bigchain, election_pk)
|
||||
votes_current = self.count_votes(election_pk, current_votes)
|
||||
|
||||
current_validators = self.get_validators(bigchain)
|
||||
total_votes = sum(current_validators.values())
|
||||
total_votes = sum(output.amount for output in self.outputs)
|
||||
if (votes_committed < (2/3) * total_votes) and \
|
||||
(votes_committed + votes_current >= (2/3)*total_votes):
|
||||
return True
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user