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


Java Transaction.getHash方法代码示例

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


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

示例1: getContainingPools

import org.bitcoinj.core.Transaction; //导入方法依赖的package包/类
EnumSet<Pool> getContainingPools(Transaction tx) {
    lock.lock();
    try {
        EnumSet<Pool> result = EnumSet.noneOf(Pool.class);
        Sha256Hash txHash = tx.getHash();
        if (unspent.containsKey(txHash)) {
            result.add(Pool.UNSPENT);
        }
        if (spent.containsKey(txHash)) {
            result.add(Pool.SPENT);
        }
        if (pending.containsKey(txHash)) {
            result.add(Pool.PENDING);
        }
        if (dead.containsKey(txHash)) {
            result.add(Pool.DEAD);
        }
        return result;
    } finally {
        lock.unlock();
    }
}
 
开发者ID:guodroid,项目名称:okwallet,代码行数:23,代码来源:Wallet.java

示例2: onCoinsReceived

import org.bitcoinj.core.Transaction; //导入方法依赖的package包/类
@Override
public void onCoinsReceived(final Wallet wallet, final Transaction tx, final Coin prevBalance,
        final Coin newBalance) {
    transactionsReceived.incrementAndGet();

    final int bestChainHeight = blockChain.getBestChainHeight();

    final Address address = WalletUtils.getWalletAddressOfReceived(tx, wallet);
    final Coin amount = tx.getValue(wallet);
    final ConfidenceType confidenceType = tx.getConfidence().getConfidenceType();
    final Sha256Hash hash = tx.getHash();

    handler.post(new Runnable() {
        @Override
        public void run() {
            final boolean isReceived = amount.signum() > 0;
            final boolean replaying = bestChainHeight < config.getBestChainHeightEver();
            final boolean isReplayedTx = confidenceType == ConfidenceType.BUILDING && replaying;

            if (isReceived && !isReplayedTx)
                notifyCoinsReceived(address, amount, hash);
        }
    });
}
 
开发者ID:guodroid,项目名称:okwallet,代码行数:25,代码来源:BlockchainServiceImpl.java

示例3: add

import org.bitcoinj.core.Transaction; //导入方法依赖的package包/类
/**
 * Add a transaction to the tracked list. The TransactionList automatically adds itself as a confidence listener
 * at this transaction
 * @param transaction to be added to the list
 */
void add(Transaction transaction) {
    logger.debug("Adding tx %s to TransactionList", transaction.getHashAsString());

    Sha256Hash txHash = transaction.getHash();

    Transaction prevValue = transactions.put(txHash, transaction);
    if (null != prevValue) prevValue.getConfidence().removeEventListener(this);
    transaction.getConfidence().addEventListener(this);

    logger.debug("This list has now %d transactions", transactions.size());
    informStateListenersTransactionsChanged(getTransactions());
}
 
开发者ID:IUNO-TDM,项目名称:PaymentService,代码行数:18,代码来源:TransactionList.java


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