Exemple #1
0
def test_public_key_encoding_decoding():
    from bigchaindb.tendermint.utils import (public_key_from_base64,
                                             public_key_to_base64)

    public_key = public_key_from_base64(SAMPLE_PUBLIC_KEY['pub_key']['value'])
    base64_public_key = public_key_to_base64(public_key)

    assert base64_public_key == SAMPLE_PUBLIC_KEY['pub_key']['value']
def run_upsert_validator(args):
    """Store validators which should be synced with Tendermint"""

    b = bigchaindb.Bigchain()
    public_key = public_key_from_base64(args.public_key)
    validator = {'pub_key': {'type': 'ed25519',
                             'data': public_key},
                 'power': args.power}
    validator_update = {'validator': validator,
                        'update_id': VALIDATOR_UPDATE_ID}
    try:
        query.store_validator_update(b.connection, validator_update)
    except MultipleValidatorOperationError:
        logger.error('A validator update is pending to be applied. '
                     'Please re-try after the current update has '
                     'been processed.')