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


Java Transaction.isMature方法代码示例

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


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

示例1: getWatchedOutputs

import org.bitcoinj.core.Transaction; //导入方法依赖的package包/类
/**
 * Returns all the outputs that match addresses or scripts added via {@link #addWatchedAddress(Address)} or
 * {@link #addWatchedScripts(java.util.List)}.
 * @param excludeImmatureCoinbases Whether to ignore outputs that are unspendable due to being immature.
 */
public List<TransactionOutput> getWatchedOutputs(boolean excludeImmatureCoinbases) {
    lock.lock();
    keyChainGroupLock.lock();
    try {
        LinkedList<TransactionOutput> candidates = Lists.newLinkedList();
        for (Transaction tx : Iterables.concat(unspent.values(), pending.values())) {
            if (excludeImmatureCoinbases && !tx.isMature()) continue;
            for (TransactionOutput output : tx.getOutputs()) {
                if (!output.isAvailableForSpending()) continue;
                try {
                    Script scriptPubKey = output.getScriptPubKey();
                    if (!watchedScripts.contains(scriptPubKey)) continue;
                    candidates.add(output);
                } catch (ScriptException e) {
                    // Ignore
                }
            }
        }
        return candidates;
    } finally {
        keyChainGroupLock.unlock();
        lock.unlock();
    }
}
 
开发者ID:guodroid,项目名称:okwallet,代码行数:30,代码来源:Wallet.java

示例2: calculateAllSpendCandidates

import org.bitcoinj.core.Transaction; //导入方法依赖的package包/类
/**
 * Returns a list of all outputs that are being tracked by this wallet either from the {@link UTXOProvider}
 * (in this case the existence or not of private keys is ignored), or the wallets internal storage (the default)
 * taking into account the flags.
 *
 * @param excludeImmatureCoinbases Whether to ignore coinbase outputs that we will be able to spend in future once they mature.
 * @param excludeUnsignable Whether to ignore outputs that we are tracking but don't have the keys to sign for.
 */
public List<TransactionOutput> calculateAllSpendCandidates(boolean excludeImmatureCoinbases, boolean excludeUnsignable) {
    lock.lock();
    try {
        List<TransactionOutput> candidates;
        if (vUTXOProvider == null) {
            candidates = new ArrayList<>(myUnspents.size());
            for (TransactionOutput output : myUnspents) {
                if (excludeUnsignable && !canSignFor(output.getScriptPubKey())) continue;
                Transaction transaction = checkNotNull(output.getParentTransaction());
                if (excludeImmatureCoinbases && !transaction.isMature())
                    continue;
                candidates.add(output);
            }
        } else {
            candidates = calculateAllSpendCandidatesFromUTXOProvider(excludeImmatureCoinbases);
        }
        return candidates;
    } finally {
        lock.unlock();
    }
}
 
开发者ID:guodroid,项目名称:okwallet,代码行数:30,代码来源:Wallet.java


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