def namedb_is_history_snapshot( history_snapshot ):
    """
    Given a dict, verify that it is a history snapshot.
    It must have all consensus fields.
    Return True if so.
    Raise an exception of it doesn't.
    """
    
    # sanity check:  each mutate field in the operation must be defined in op_data, even if it's null.
    missing = []

    assert 'op' in history_snapshot.keys(), "BUG: no op given"

    opcode = op_get_opcode_name( history_snapshot['op'] )
    assert opcode is not None, "BUG: unrecognized op '%s'" % history_snapshot['op']

    consensus_fields = op_get_consensus_fields( opcode )
    for field in consensus_fields:
        if field not in history_snapshot.keys():
            missing.append( field )

    assert len(missing) == 0, ("BUG: operation '%s' is missing the following fields: %s" % (opcode, ",".join(missing)))
    return True
def namedb_is_history_snapshot ( history_snapshot ) : missing = [ ] assert 'op' in history_snapshot . keys ( ) , "BUG: no op given" opcode = op_get_opcode_name ( history_snapshot [ 'op' ] ) assert opcode is not None , "BUG: unrecognized op '%s'" % history_snapshot [ 'op' ] consensus_fields = op_get_consensus_fields ( opcode ) for field in consensus_fields : if field not in history_snapshot . keys ( ) : missing . append ( field ) assert len ( missing ) == 0 , ( "BUG: operation '%s' is missing the following fields: %s" % ( opcode , "," . join ( missing ) ) ) return True
Given a dict, verify that it is a history snapshot.
    It must have all consensus fields.
    Return True if so.
    Raise an exception of it doesn't.