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