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


Java Transaction.getConfidence方法代码示例

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


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

示例1: isSelectable

import com.google.bitcoin.core.Transaction; //导入方法依赖的package包/类
public static boolean isSelectable(Transaction tx) {
    // Only pick chain-included transactions, or transactions that are ours and pending.
    TransactionConfidence confidence = tx.getConfidence();
    TransactionConfidence.ConfidenceType type = confidence.getConfidenceType();
    return type.equals(TransactionConfidence.ConfidenceType.BUILDING) ||

           type.equals(TransactionConfidence.ConfidenceType.PENDING) &&
           confidence.getSource().equals(TransactionConfidence.Source.SELF) &&
           // In regtest mode we expect to have only one peer, so we won't see transactions propagate.
           // TODO: The value 1 below dates from a time when transactions we broadcast *to* were counted, set to 0
           (confidence.numBroadcastPeers() > 1 || tx.getParams() == RegTestParams.get());
}
 
开发者ID:HashEngineering,项目名称:megacoinj,代码行数:13,代码来源:DefaultCoinSelector.java

示例2: isSelectable

import com.google.bitcoin.core.Transaction; //导入方法依赖的package包/类
public static boolean isSelectable(Transaction tx, int requiredNumBroadcastPeers) {
    // Only pick chain-included transactions, or transactions that are ours and pending.
    TransactionConfidence confidence = tx.getConfidence();
    TransactionConfidence.ConfidenceType type = confidence.getConfidenceType();
    return type.equals(TransactionConfidence.ConfidenceType.BUILDING) ||

           type.equals(TransactionConfidence.ConfidenceType.PENDING) &&
           confidence.getSource().equals(TransactionConfidence.Source.SELF) &&
           // In regtest mode we expect to have only one peer, so we won't see transactions propagate.
           // TODO: The value 1 below dates from a time when transactions we broadcast *to* were counted, set to 0
           (confidence.numBroadcastPeers() >= requiredNumBroadcastPeers || tx.getParams() == RegTestParams.get());
}
 
开发者ID:coinspark,项目名称:sparkbit-bitcoinj,代码行数:13,代码来源:DefaultCoinSelector.java

示例3: isSelectable

import com.google.bitcoin.core.Transaction; //导入方法依赖的package包/类
public static boolean isSelectable(Transaction tx) {
    // Only pick chain-included transactions, or transactions that are ours and pending.
    TransactionConfidence confidence = tx.getConfidence();
    TransactionConfidence.ConfidenceType type = confidence.getConfidenceType();
    if (type.equals(TransactionConfidence.ConfidenceType.BUILDING))
        return true;
    return type.equals(TransactionConfidence.ConfidenceType.PENDING) &&
           confidence.getSource().equals(TransactionConfidence.Source.SELF) &&
           confidence.numBroadcastPeers() > 1;
}
 
开发者ID:9cat,项目名称:templecoin-java,代码行数:11,代码来源:DefaultCoinSelector.java

示例4: onTransactionConfidenceChanged

import com.google.bitcoin.core.Transaction; //导入方法依赖的package包/类
@Override
public void onTransactionConfidenceChanged(Wallet wallet, Transaction transaction) {
    if (controller.getCurrentView() == View.TRANSACTIONS_VIEW) {
        ShowTransactionsPanel.updateTransactions(); 
    } else if (controller.getCurrentView() == View.SEND_BITCOIN_VIEW) {
        final int numberOfPeers = (transaction == null || transaction.getConfidence() == null) ? 0 : transaction.getConfidence().getBroadcastByCount();
        //log.debug("numberOfPeers = " + numberOfPeers);
        final Sha256Hash transactionHash = (transaction == null) ? null : transaction.getHash();
        //log.debug((transaction != null && transaction.getConfidence() != null) ? transaction.getConfidence().toString() : "No transaction confidence for tx");
        SendBitcoinConfirmPanel.updatePanelDueToTransactionConfidenceChange(transactionHash, numberOfPeers); 
    }
}
 
开发者ID:coinspark,项目名称:sparkbit,代码行数:13,代码来源:MultiBitFrame.java

示例5: getBuildingIcon

import com.google.bitcoin.core.Transaction; //导入方法依赖的package包/类
private ImageIcon getBuildingIcon(int numberOfBlocksEmbedded, Transaction transaction) {
    TransactionConfidence confidence = null;
    if (transaction != null) {
	confidence = transaction.getConfidence();
    }

    if (numberOfBlocksEmbedded < 0) {
	numberOfBlocksEmbedded = 0;
    }
    if (numberOfBlocksEmbedded > 6) {
	numberOfBlocksEmbedded = 6;
    }

    boolean isLeftToRight = ComponentOrientation.getOrientation(controller.getLocaliser().getLocale()).isLeftToRight();

    switch (numberOfBlocksEmbedded) {
	case 0: {
	    return getConfidenceIcon(confidence);
	}
	case 1: {
	    if (isLeftToRight) {
		return progress1Icon;
	    } else {
		return rtlProgress1Icon;
	    }
	}
	case 2: {
	    if (isLeftToRight) {
		return progress2Icon;
	    } else {
		return rtlProgress2Icon;
	    }
	}
	case 3: {
	    if (isLeftToRight) {
		return progress3Icon;
	    } else {
		return rtlProgress3Icon;
	    }
	}
	case 4: {
	    if (isLeftToRight) {
		return progress4Icon;
	    } else {
		return rtlProgress4Icon;
	    }
	}
	case 5: {
	    if (isLeftToRight) {
		return progress5Icon;
	    } else {
		return rtlProgress5Icon;
	    }
	}
	case 6: {
	    return tickIcon;
	}
	default:
	    return getConfidenceIcon(confidence);
    }
}
 
开发者ID:coinspark,项目名称:sparkbit,代码行数:62,代码来源:ShowTransactionsPanel.java

示例6: getUnconfirmedConfidenceToolTip

import com.google.bitcoin.core.Transaction; //导入方法依赖的package包/类
private String getUnconfirmedConfidenceToolTip(Transaction transaction) {
    TransactionConfidence confidence = null;
    if (transaction != null) {
	confidence = transaction.getConfidence();
    }

    // Work out the line describing the is the transaction is standard or not.
    String transactionTrustfulness = "";
    if (transaction != null) {
	if (transaction.getLockTime() > 0) {
	    // Non standard transaction.
	    transactionTrustfulness = SparkBit.getController().getLocaliser().getString("multiBitFrame.status.notConfirmedAndNotStandard") + ".";
	} else {
	    // Normal transaction.
	    if (transaction.isCoinBase()) {
		transactionTrustfulness = SparkBit.getController().getLocaliser().getString("multiBitFrame.status.notConfirmedAndCoinbase") + ".";
	    } else {
		transactionTrustfulness = SparkBit.getController().getLocaliser().getString("multiBitFrame.status.notConfirmed") + ".";
	    }
	}
    }

    // Work out the line describing the number of peers.
    int peers = 0;
    if (confidence != null) {
	peers = confidence.getBroadcastByCount();
    }
    StringBuilder builder = new StringBuilder();
    if (peers == 0) {
	builder.append(SparkBit.getController().getLocaliser()
		.getString("transactionConfidence.seenByUnknownNumberOfPeers"));
    } else {
	builder
		.append(SparkBit.getController().getLocaliser().getString("transactionConfidence.seenBy"))
		.append(" ");
	builder.append(peers);
               if (peers > 1)
	    builder
		    .append(" ")
		    .append(SparkBit.getController().getLocaliser().getString("transactionConfidence.peers"))
		    .append(". ");
               else
	    builder
		    .append(" ")
		    .append(SparkBit.getController().getLocaliser().getString("transactionConfidence.peer"))
		    .append(". ");
	}

           return HelpContentsPanel.createMultilineTooltipText(new String[] {
                   transactionTrustfulness, builder.toString() });
}
 
开发者ID:coinspark,项目名称:sparkbit,代码行数:52,代码来源:ShowTransactionsPanel.java


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