From 7d756bf1a99c28096443fbf31353458b598306ef Mon Sep 17 00:00:00 2001 From: z-bowen Date: Tue, 4 Sep 2018 17:23:24 +0200 Subject: [PATCH] Problem: Hardcoded reference to the `VOTE_TYPE` in `Election` base class Solution: Pointed the reference to the class variable --- bigchaindb/common/election.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bigchaindb/common/election.py b/bigchaindb/common/election.py index 52d34b45..ed7bfa92 100644 --- a/bigchaindb/common/election.py +++ b/bigchaindb/common/election.py @@ -162,7 +162,7 @@ class Election(Transaction): def count_votes(cls, election_pk, transactions, getter=getattr): votes = 0 for txn in transactions: - if getter(txn, 'operation') == 'VOTE': + if getter(txn, 'operation') == cls.VOTE_TYPE: for output in getter(txn, 'outputs'): # NOTE: We enforce that a valid vote to election id will have only # election_pk in the output public keys, including any other public key