From f2f045c730a4fcc5e5a23d13ead5ca77c525d0c7 Mon Sep 17 00:00:00 2001 From: z-bowen Date: Fri, 14 Sep 2018 12:13:12 +0200 Subject: [PATCH] Problem: Tendermint change to store validator changes at height h+2 will break `Election.get_status` Solution: Reworked `get_validator_change` to look at only the latest block height or less --- bigchaindb/elections/election.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/bigchaindb/elections/election.py b/bigchaindb/elections/election.py index 7700ea1c..f11bdbfc 100644 --- a/bigchaindb/elections/election.py +++ b/bigchaindb/elections/election.py @@ -35,7 +35,7 @@ class Election(Transaction): ELECTION_THRESHOLD = 2 / 3 @classmethod - def get_validator_change(cls, bigchain, height=None): + def get_validator_change(cls, bigchain): """Return the latest change to the validator set :return: { @@ -44,6 +44,7 @@ class Election(Transaction): 'election_id': } """ + height = bigchain.get_latest_block()['height'] return bigchain.get_validator_change(height) @classmethod