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


Java WalletTransaction.Pool方法代码示例

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


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

示例1: getExtendedTransactionPool

import org.bitcoinj.wallet.WalletTransaction; //导入方法依赖的package包/类
@Nullable
@Override
public Map<Sha256Hash, Transaction> getExtendedTransactionPool(WalletTransaction.Pool pool) {
    checkState(CoreHelper.getWalletLock(wallet).isHeldByCurrentThread());
    if (pool == INSTANTX_PENDING) {
        return instantXPending;
    } else if (pool == INSTANTX_LOCKED) {
        return instantXLocked;
    } else {
        return null;
    }
}
 
开发者ID:btcsoft,项目名称:coinj-dash,代码行数:13,代码来源:DashWalletCoinSpecifics.java

示例2: putTransactionIntoPool

import org.bitcoinj.wallet.WalletTransaction; //导入方法依赖的package包/类
@Nullable
@Override
public Transaction putTransactionIntoPool(WalletTransaction.Pool pool, Sha256Hash key, Transaction value) throws IllegalArgumentException {
    checkState(CoreHelper.getWalletLock(wallet).isHeldByCurrentThread());
    final DashTransactionExtension txExtension = CommonUtils.extractTransactionExtension(value);
    final DashTransactionWireStrategy wireStrategy = txExtension.getWireStrategy();
    if (wireStrategy == DashTransactionWireStrategy.INSTANT_X_LOCKED || wireStrategy == DashTransactionWireStrategy.INSTANT_X) {
        if (InstantXManager.isTransactionExpired(txExtension)) {
            logger.warn("Wallet coin specifics transaction pool put with wire strategy {}, but wire lock expired;");
            logger.warn("that can happen if we load a wallet from file;");
            logger.warn("we'll put it in a wallet as PENDING for now and will wait for discovery of a block which contains it.");
            wallet.addWalletTransaction(new WalletTransaction(WalletTransaction.Pool.PENDING, value));
            return null;
        }

        if (pool == INSTANTX_PENDING) {
            return instantXPending.put(key, value);
        } else if (pool == INSTANTX_LOCKED) {
            if (instantXPending.remove(key) != null) {
                logger.info("<-instantx locked: {}", value.getHashAsString());
            }
            return instantXLocked.put(key, value);
        } else {
            throw new IllegalArgumentException("Pool " + pool + " unsupported");
        }
    } else {
        logger.warn("Wallet coin specifics transaction pool put, but transactions wire strategy is " + wireStrategy);
        wallet.addWalletTransaction(new WalletTransaction(WalletTransaction.Pool.PENDING, value));
        return null;
    }
}
 
开发者ID:btcsoft,项目名称:coinj-dash,代码行数:32,代码来源:DashWalletCoinSpecifics.java

示例3: addPoolsToSetIfContainKey

import org.bitcoinj.wallet.WalletTransaction; //导入方法依赖的package包/类
@Override
public void addPoolsToSetIfContainKey(Set<WalletTransaction.Pool> set, Sha256Hash key) {
    checkState(CoreHelper.getWalletLock(wallet).isHeldByCurrentThread());
    if (instantXPending.containsKey(key))
        set.add(INSTANTX_PENDING);
    if (instantXLocked.containsKey(key))
        set.add(INSTANTX_LOCKED);
}
 
开发者ID:btcsoft,项目名称:coinj-dash,代码行数:9,代码来源:DashWalletCoinSpecifics.java

示例4: getPoolSize

import org.bitcoinj.wallet.WalletTransaction; //导入方法依赖的package包/类
@Nullable
@Override
public Integer getPoolSize(WalletTransaction.Pool pool) {
    checkState(CoreHelper.getWalletLock(wallet).isHeldByCurrentThread());
    if (pool == INSTANTX_PENDING) {
        return instantXPending.size();
    } else if (pool == INSTANTX_LOCKED) {
        return instantXLocked.size();
    } else {
        return null;
    }
}
 
开发者ID:btcsoft,项目名称:coinj-dash,代码行数:13,代码来源:DashWalletCoinSpecifics.java

示例5: commitTxExtendedPool

import org.bitcoinj.wallet.WalletTransaction; //导入方法依赖的package包/类
@Override
@Nullable
public WalletTransaction.Pool commitTxExtendedPool(Transaction tx) {
    final TransactionWireStrategy wireStrategy = tx.getTransactionExtension().getWireStrategy();
    return wireStrategy == DashTransactionWireStrategy.INSTANT_X
            ? INSTANTX_PENDING
            : wireStrategy == DashTransactionWireStrategy.INSTANT_X_LOCKED ? INSTANTX_LOCKED : null;
}
 
开发者ID:btcsoft,项目名称:coinj-dash,代码行数:9,代码来源:DashWalletCoinSpecifics.java

示例6: getPoolName

import org.bitcoinj.wallet.WalletTransaction; //导入方法依赖的package包/类
@Override
public String getPoolName(WalletTransaction.Pool pool) {
    if (pool == INSTANTX_LOCKED)
        return "instantx locked";
    else if (pool == INSTANTX_PENDING)
        return "instantx pending";

    return null;
}
 
开发者ID:btcsoft,项目名称:coinj-dash,代码行数:10,代码来源:DashWalletCoinSpecifics.java

示例7: getProtoExtendedPool

import org.bitcoinj.wallet.WalletTransaction; //导入方法依赖的package包/类
@Nullable
@Override
public Protos.Transaction.Pool getProtoExtendedPool(WalletTransaction.Pool pool) {
    if (pool == DashWalletCoinSpecifics.INSTANTX_PENDING) {
        return Protos.Transaction.Pool.INSTANTX_PENDING;
    } else if (pool == DashWalletCoinSpecifics.INSTANTX_LOCKED) {
        return Protos.Transaction.Pool.INSTANTX_LOCKED;
    } else {
        return null;
    }
}
 
开发者ID:btcsoft,项目名称:coinj-dash,代码行数:12,代码来源:DashWalletProtobufSerializerExtension.java

示例8: getTxsExtendedPool

import org.bitcoinj.wallet.WalletTransaction; //导入方法依赖的package包/类
@Nullable
@Override
public WalletTransaction.Pool getTxsExtendedPool(Protos.Transaction.Pool pool) {
    switch (pool) {
        case INSTANTX_LOCKED:
            return DashWalletCoinSpecifics.INSTANTX_LOCKED;
        case INSTANTX_PENDING:
            return DashWalletCoinSpecifics.INSTANTX_PENDING;
        default:
            return null;
    }
}
 
开发者ID:btcsoft,项目名称:coinj-dash,代码行数:13,代码来源:DashWalletProtobufSerializerExtension.java

示例9: getTransactionPool

import org.bitcoinj.wallet.WalletTransaction; //导入方法依赖的package包/类
/** Returns transactions from a specific pool. */
Map<Sha256Hash, Transaction> getTransactionPool(WalletTransaction.Pool pool);
 
开发者ID:guodroid,项目名称:okwallet,代码行数:3,代码来源:TransactionBag.java

示例10: getTransactionPool

import org.bitcoinj.wallet.WalletTransaction; //导入方法依赖的package包/类
/** Returns transactions from a specific pool. */
public Map<Sha256Hash, Transaction> getTransactionPool(WalletTransaction.Pool pool);
 
开发者ID:HashEngineering,项目名称:namecoinj,代码行数:3,代码来源:TransactionBag.java

示例11: connectTransactionOutputs

import org.bitcoinj.wallet.WalletTransaction; //导入方法依赖的package包/类
private WalletTransaction connectTransactionOutputs(org.bitcoinj.wallet.Protos.Transaction txProto) throws UnreadableWalletException {
    Transaction tx = txMap.get(txProto.getHash());
    final WalletTransaction.Pool pool;
    switch (txProto.getPool()) {
        case DEAD: pool = WalletTransaction.Pool.DEAD; break;
        case PENDING: pool = WalletTransaction.Pool.PENDING; break;
        case SPENT: pool = WalletTransaction.Pool.SPENT; break;
        case UNSPENT: pool = WalletTransaction.Pool.UNSPENT; break;
        // Upgrade old wallets: inactive pool has been merged with the pending pool.
        // Remove this some time after 0.9 is old and everyone has upgraded.
        // There should not be any spent outputs in this tx as old wallets would not allow them to be spent
        // in this state.
        case INACTIVE:
        case PENDING_INACTIVE:
            pool = WalletTransaction.Pool.PENDING;
            break;
        default:
            throw new UnreadableWalletException("Unknown transaction pool: " + txProto.getPool());
    }
    for (int i = 0 ; i < tx.getOutputs().size() ; i++) {
        TransactionOutput output = tx.getOutputs().get(i);
        final Protos.TransactionOutput transactionOutput = txProto.getTransactionOutput(i);
        if (transactionOutput.hasSpentByTransactionHash()) {
            final ByteString spentByTransactionHash = transactionOutput.getSpentByTransactionHash();
            Transaction spendingTx = txMap.get(spentByTransactionHash);
            if (spendingTx == null) {
                throw new UnreadableWalletException(String.format("Could not connect %s to %s",
                        tx.getHashAsString(), byteStringToHash(spentByTransactionHash)));
            }
            final int spendingIndex = transactionOutput.getSpentByTransactionIndex();
            TransactionInput input = checkNotNull(spendingTx.getInput(spendingIndex));
            input.connect(output);
        }
    }
    
    if (txProto.hasConfidence()) {
        Protos.TransactionConfidence confidenceProto = txProto.getConfidence();
        TransactionConfidence confidence = tx.getConfidence();
        readConfidence(tx, confidenceProto, confidence);
    }

    return new WalletTransaction(pool, tx);
}
 
开发者ID:HashEngineering,项目名称:namecoinj,代码行数:44,代码来源:WalletProtobufSerializer.java


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