Problem: get_validator doesn't sepcify height leading to ambiguity

Solution: get_validator should specify the height of the latest block witnessed
by BigchainDB so that in case tendermint is ahead of BigchainDB correct
validator set can be fetched
This commit is contained in:
Vanshdeep Singh 2018-08-02 10:31:06 +02:00
parent 49bc495cc4
commit 25da49582b

View File

@ -462,7 +462,10 @@ class BigchainDB(object):
def get_validators(self):
try:
resp = requests.get('{}validators'.format(self.endpoint))
block = self.get_latest_block()
query_args = ('?height=' + str(block['height'])) if block else ''
resp = requests.get('{}validators{}'.format(self.endpoint, query_args))
validators = resp.json()['result']['validators']
for v in validators:
v.pop('accum')