示例#1
0
def get_verification_record(record):
    """ returns a thrift representation of a dictionary verification record """
    thrift_record = message_types.VerificationRecordCommonInfo()
    thrift_record.block_id = record['block_id']
    thrift_record.origin_id = record['origin_id']
    thrift_record.phase = record['phase']
    thrift_record.verification_ts = record['verification_ts']
    thrift_record.lower_phase_hash = record['lower_phase_hash']

    if record['prior_hash']:
        thrift_record.prior_hash = record['prior_hash']

    thrift_record.signature = convert_to_thrift_signature(record['signature'])

    return thrift_record
示例#2
0
def convert_to_thrift_record(record):
    """ returns a thrift representation of a dictionary VerificationRecordCommonInfo """
    verification_id = None
    if 'verification_id' in record:
        verification_id = record['verification_id']
    thrift_record = message_types.VerificationRecordCommonInfo()
    thrift_record.block_id = record['block_id']
    thrift_record.origin_id = record['origin_id']
    thrift_record.phase = record['phase']
    thrift_record.verification_ts = record['verification_ts']
    thrift_record.verification_id = verification_id
    thrift_record.lower_hash = record['lower_hash']
    thrift_record.public_transmission = record['public_transmission']

    if record['prior_hash']:
        thrift_record.prior_hash = record['prior_hash']

    thrift_record.signature = convert_to_thrift_signature(record['signature'])

    return thrift_record