def test_end_block_return_validator_updates(b): from bigchaindb import App from bigchaindb.backend import query from bigchaindb.core import encode_validator from bigchaindb.backend.query import VALIDATOR_UPDATE_ID app = App(b) app.init_chain(['ignore']) begin_block = RequestBeginBlock() app.begin_block(begin_block) validator = { 'pub_key': { 'type': 'ed25519', 'data': 'B0E42D2589A455EAD339A035D6CE1C8C3E25863F268120AA0162AD7D003A4014' }, 'power': 10 } validator_update = { 'validator': validator, 'update_id': VALIDATOR_UPDATE_ID } query.store_validator_update(b.connection, validator_update) resp = app.end_block(RequestEndBlock(height=99)) assert resp.validator_updates[0] == encode_validator(validator) updates = b.get_validator_update() assert updates == []
def test_end_block_return_validator_updates(b, init_chain_request): from bigchaindb import App from bigchaindb.backend import query from bigchaindb.core import encode_validator from bigchaindb.backend.query import VALIDATOR_UPDATE_ID app = App(b) app.init_chain(init_chain_request) begin_block = RequestBeginBlock() app.begin_block(begin_block) validator = {'pub_key': {'type': 'ed25519', 'data': 'B0E42D2589A455EAD339A035D6CE1C8C3E25863F268120AA0162AD7D003A4014'}, 'power': 10} validator_update = {'validator': validator, 'update_id': VALIDATOR_UPDATE_ID} query.store_validator_update(b.connection, validator_update) resp = app.end_block(RequestEndBlock(height=99)) assert resp.validator_updates[0] == encode_validator(validator) updates = b.approved_update() assert not updates