From 5e4e2eefb3da038bf00ab2c9373f8cefdc6eba72 Mon Sep 17 00:00:00 2001 From: ryan Date: Thu, 12 May 2016 12:39:53 +0200 Subject: [PATCH] election status class constants --- bigchaindb/core.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/bigchaindb/core.py b/bigchaindb/core.py index b5f0dc7a..9a433697 100644 --- a/bigchaindb/core.py +++ b/bigchaindb/core.py @@ -22,6 +22,10 @@ class Bigchain(object): Create, read, sign, write transactions to the database """ + BLOCK_INVALID = 'invalid' + BLOCK_VALID = 'valid' + BLOCK_UNDECIDED = 'undecided' + def __init__(self, host=None, port=None, dbname=None, public_key=None, private_key=None, keyring=[], consensus_plugin=None): @@ -510,8 +514,8 @@ class Bigchain(object): # to avoid a tie. In the case of an odd number of voters this is not # relevant, since one side must be a majority. if n_invalid_votes >= math.ceil(n_voters / 2): - return 'invalid' + return Bigchain.BLOCK_INVALID elif n_valid_votes > math.floor(n_voters / 2): - return 'valid' + return Bigchain.BLOCK_VALID else: - return 'undecided' + return Bigchain.BLOCK_UNDECIDED