From 25da49582b474ab082c4468bf08d709f7d3addfc Mon Sep 17 00:00:00 2001 From: Vanshdeep Singh Date: Thu, 2 Aug 2018 10:31:06 +0200 Subject: [PATCH] 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 --- bigchaindb/lib.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/bigchaindb/lib.py b/bigchaindb/lib.py index b0545d83..3320711a 100644 --- a/bigchaindb/lib.py +++ b/bigchaindb/lib.py @@ -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')