diff --git a/bigchaindb/upsert_validator/validator_election.py b/bigchaindb/upsert_validator/validator_election.py index f39f78b2..27e0ff56 100644 --- a/bigchaindb/upsert_validator/validator_election.py +++ b/bigchaindb/upsert_validator/validator_election.py @@ -42,8 +42,8 @@ class ValidatorElection(Election): latest_block_height = latest_block['height'] latest_validator_change = bigchain.get_validator_change()['height'] - # TODO change to `latest_block_height + 2` when upgrading to Tendermint 0.24.0. - if latest_validator_change == latest_block_height + 1: + # TODO change to `latest_block_height + 3` when upgrading to Tendermint 0.24.0. + if latest_validator_change == latest_block_height + 2: # do not conclude the election if there is a change assigned already return False diff --git a/tests/elections/test_election.py b/tests/elections/test_election.py index 2258e846..ccef0e29 100644 --- a/tests/elections/test_election.py +++ b/tests/elections/test_election.py @@ -39,7 +39,7 @@ def test_process_block_concludes_all_elections(b): app_hash='')._asdict()) b.store_bulk_transactions(txs) - Election.process_block(b, 1, txs + total_votes) + Election.process_block(b, 2, txs + total_votes) validators = b.get_validators() assert len(validators) == 5 @@ -87,7 +87,7 @@ def test_process_block_approves_only_one_validator_update(b): app_hash='')._asdict()) b.store_bulk_transactions(txs) - Election.process_block(b, 1, txs + total_votes) + Election.process_block(b, 2, txs + total_votes) validators = b.get_validators() assert len(validators) == 5 @@ -137,7 +137,7 @@ def test_process_block_approves_after_pending_validator_update(b): app_hash='')._asdict()) b.store_bulk_transactions(txs) - Election.process_block(b, 1, txs + total_votes) + Election.process_block(b, 2, txs + total_votes) validators = b.get_validators() assert len(validators) == 5 @@ -174,7 +174,7 @@ def test_process_block_does_not_approve_after_validator_update(b): app_hash='')._asdict()) b.store_bulk_transactions(txs) - Election.process_block(b, 1, txs + total_votes) + Election.process_block(b, 2, txs + total_votes) b.store_block(Block(height=2, transactions=[v.id for v in total_votes], @@ -188,7 +188,7 @@ def test_process_block_does_not_approve_after_validator_update(b): total_votes = votes b.store_abci_chain(1, 'chain-X') - Election.process_block(b, 2, txs + total_votes) + Election.process_block(b, 3, txs + total_votes) assert not b.get_election(election.id)['is_concluded'] assert b.get_latest_abci_chain() == {'height': 1,