Verify that for a version-2 namespace (burn-to-creator), the nameop paid the right amount of BTC or Stacks.
    It can pay either through a preorder (for registers), or directly (for renewals)

    Return {'status': True, 'tokens_paid': ..., 'token_units': ...} if so
    Return {'status': False} if not.

def check_payment_v2(state_engine, state_op_type, nameop, fee_block_id, token_address, burn_address, name_fee, block_id):
    """
    Verify that for a version-2 namespace (burn-to-creator), the nameop paid the right amount of BTC or Stacks.
    It can pay either through a preorder (for registers), or directly (for renewals)

    Return {'status': True, 'tokens_paid': ..., 'token_units': ...} if so
    Return {'status': False} if not.
    """
    # priced in BTC only if the namespace creator can receive name fees.
    # once the namespace switches over to burning, then the name creator can pay in Stacks as well.
    assert name_fee is not None
    assert isinstance(name_fee, (int,long))

    epoch_features = get_epoch_features(block_id)

    name = nameop['name']
    namespace_id = get_namespace_from_name(name)
    name_without_namespace = get_name_from_fq_name(name)
    namespace = state_engine.get_namespace( namespace_id )
    assert namespace['version'] == NAMESPACE_VERSION_PAY_TO_CREATOR

    # need to be in the right epoch--i.e. pay-to-creator needs to be a feature
    if EPOCH_FEATURE_NAMESPACE_BURN_TO_CREATOR not in epoch_features:
        log.warning("Name '{}' was created in namespace '{}', with cversion bits 0x{:x}, which is not supported in this epoch".format(name, namespace['namespace_id'], namespace['version']))
        return {'status': False}

    # check burn address
    receive_fees_period = get_epoch_namespace_receive_fees_period(block_id, namespace['namespace_id'])
    expected_burn_address = None
    tokens_allowed = None

    # can only burn to namespace if the namespace is young enough (starts counting from NAMESPACE_REVEAL)
    # can only pay in tokens if the register takes place after the pay-to-creator period (receive_fees_period) expires
    if namespace['reveal_block'] + receive_fees_period >= block_id:
        log.debug("Register must pay to v2 namespace address {}".format(namespace['address']))
        expected_burn_address = namespace['address']
        tokens_allowed = False
    else:
        log.debug("Register must pay to burn address {}".format(BLOCKSTACK_BURN_ADDRESS))
        expected_burn_address = BLOCKSTACK_BURN_ADDRESS
        tokens_allowed = True

    if burn_address != expected_burn_address:
        log.warning("Buyer of {} used the wrong burn address ({}): expected {}".format(name, burn_address, expected_burn_address))
        return {'status': False}

    # allowed to pay in Stacks?
    if EPOCH_FEATURE_NAMEOPS_COST_TOKENS in epoch_features:
        # did we pay any stacks?
        res = get_stacks_payment(state_engine, nameop, state_op_type)
        if res['status']:
            # paid something in Stacks. Will ignore BTC.
            if not tokens_allowed:
                log.warning('Buyer of {} paid in Stacks, but should have paid in BTC to the namespace creator'.format(name))
                return {'status': False}

            res = check_payment_in_stacks(state_engine, nameop, state_op_type, fee_block_id)
            if not res['status']:
                log.warning("Buyer of {} paid in Stacks, but did not pay enough".format(name))
                return {'status': False}

            tokens_paid = res['tokens_paid']
            token_units = res['token_units']
            return {'status': True, 'tokens_paid': tokens_paid, 'token_units': token_units}

    # did not pay in stacks tokens, or this isn't allowed yet
    btc_price = price_name(name_without_namespace, namespace, fee_block_id)   # price reflects namespace version
    
    # fee must be high enough (either the preorder paid the right fee at the preorder block height,
    # or the renewal paid the right fee at the renewal height)
    if name_fee < btc_price:
        log.warning("Name '%s' costs %s satoshis, but paid %s satoshis" % (name, btc_price, name_fee))
        return {'status': False}

    log.debug('Paid {} satoshis for {} to {}'.format(name_fee, name, burn_address))
    return {'status': True, 'tokens_paid': name_fee, 'token_units': 'BTC'}