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
This commit is contained in:
z-bowen 2018-09-14 12:13:12 +02:00
parent cc0ce0e5e4
commit f2f045c730

View File

@ -35,7 +35,7 @@ class Election(Transaction):
ELECTION_THRESHOLD = 2 / 3 ELECTION_THRESHOLD = 2 / 3
@classmethod @classmethod
def get_validator_change(cls, bigchain, height=None): def get_validator_change(cls, bigchain):
"""Return the latest change to the validator set """Return the latest change to the validator set
:return: { :return: {
@ -44,6 +44,7 @@ class Election(Transaction):
'election_id': <election_id_that_approved_the_change> 'election_id': <election_id_that_approved_the_change>
} }
""" """
height = bigchain.get_latest_block()['height']
return bigchain.get_validator_change(height) return bigchain.get_validator_change(height)
@classmethod @classmethod