当前位置: 首页>>代码示例>>Java>>正文


Java Transaction.getVersion方法代码示例

本文整理汇总了Java中com.google.bitcoin.core.Transaction.getVersion方法的典型用法代码示例。如果您正苦于以下问题:Java Transaction.getVersion方法的具体用法?Java Transaction.getVersion怎么用?Java Transaction.getVersion使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.google.bitcoin.core.Transaction的用法示例。


在下文中一共展示了Transaction.getVersion方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: isStandard

import com.google.bitcoin.core.Transaction; //导入方法依赖的package包/类
/**
 * <p>Checks if a transaction is considered "standard" by the reference client's IsStandardTx and AreInputsStandard
 * functions.</p>
 *
 * <p>Note that this method currently only implements a minimum of checks. More to be added later.</p>
 */
public static RuleViolation isStandard(Transaction tx) {
    // TODO: Finish this function off.
    if (tx.getVersion() > 1 || tx.getVersion() < 1) {
        log.warn("TX considered non-standard due to unknown version number {}", tx.getVersion());
        return RuleViolation.VERSION;
    }

    final List<TransactionOutput> outputs = tx.getOutputs();
    for (int i = 0; i < outputs.size(); i++) {
        TransactionOutput output = outputs.get(i);
        if (output.getMinNonDustValue().compareTo(output.getValue()) > 0) {
            log.warn("TX considered non-standard due to output {} being dusty", i);
            return RuleViolation.DUST;
        }
    }

    return RuleViolation.NONE;
}
 
开发者ID:HashEngineering,项目名称:megacoinj,代码行数:25,代码来源:DefaultRiskAnalysis.java

示例2: isStandard

import com.google.bitcoin.core.Transaction; //导入方法依赖的package包/类
/**
 * <p>Checks if a transaction is considered "standard" by the reference client's IsStandardTx and AreInputsStandard
 * functions.</p>
 *
 * <p>Note that this method currently only implements a minimum of checks. More to be added later.</p>
 */
public static RuleViolation isStandard(Transaction tx) {
    // TODO: Finish this function off.
    if (tx.getVersion() > 1 || tx.getVersion() < 1) {
        log.warn("TX considered non-standard due to unknown version number {}", tx.getVersion());
        return RuleViolation.VERSION;
    }

    final List<TransactionOutput> outputs = tx.getOutputs();
    for (int i = 0; i < outputs.size(); i++) {
        TransactionOutput output = outputs.get(i);
        if (MIN_ANALYSIS_NONDUST_OUTPUT.compareTo(output.getValue()) > 0) {
            log.warn("TX considered non-standard due to output {} being dusty", i);
            return RuleViolation.DUST;
        }
    }

    return RuleViolation.NONE;
}
 
开发者ID:HashEngineering,项目名称:quarkcoinj,代码行数:25,代码来源:DefaultRiskAnalysis.java

示例3: isStandard

import com.google.bitcoin.core.Transaction; //导入方法依赖的package包/类
/**
 * <p>Checks if a transaction is considered "standard" by the reference client's IsStandardTx and AreInputsStandard
 * functions.</p>
 *
 * <p>Note that this method currently only implements a minimum of checks. More to be added later.</p>
 *
 * @return Either null if the transaction is standard, or the first transaction found which is considered nonstandard
 */
public Transaction isStandard(Transaction tx) {
    if (tx.getVersion() > 1 || tx.getVersion() < 1)
        return tx;

    for (TransactionOutput output : tx.getOutputs()) {
        if (output.getMinNonDustValue().compareTo(output.getValue()) > 0)
            return tx;
    }

    return null;
}
 
开发者ID:10xEngineer,项目名称:My-Wallet-Android,代码行数:20,代码来源:DefaultRiskAnalysis.java

示例4: isStandard

import com.google.bitcoin.core.Transaction; //导入方法依赖的package包/类
/**
     * <p>Checks if a transaction is considered "standard" by the reference client's IsStandardTx and AreInputsStandard
     * functions.</p>
     *
     * <p>Note that this method currently only implements a minimum of checks. More to be added later.</p>
     *
     * @return Either null if the transaction is standard, or the first transaction found which is considered nonstandard
     */
    public Transaction isStandard(Transaction tx) {
        if (tx.getVersion() > 1 || tx.getVersion() < 1)
            return tx;

/* CSPK-mike START */               
/* Bitcoin 0.9 allows zero values for non-standard outputs */
/*        
        for (TransactionOutput output : tx.getOutputs()) {
            if (MIN_ANALYSIS_NONDUST_OUTPUT.compareTo(output.getValue()) > 0)
                    return tx;
 */

        boolean txNonStandard=false;
        for (TransactionOutput output : tx.getOutputs()) {
            if (MIN_ANALYSIS_NONDUST_OUTPUT.compareTo(output.getValue()) > 0)
            {
                byte[] scriptBytes = output.getScriptBytes();

                if(CoinSparkBase.scriptIsRegular(scriptBytes))                  // Zero value is allowed by Bitcoin 0.9 for OP_RETRUN outputs
                {
                    return tx;
                }
            }
        }
/* CSPK-mike START */                        

        return null;
    }
 
开发者ID:coinspark,项目名称:sparkbit-bitcoinj,代码行数:37,代码来源:DefaultRiskAnalysis.java


注:本文中的com.google.bitcoin.core.Transaction.getVersion方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。