本文整理汇总了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;
}
示例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;
}
示例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;
}
示例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;
}