public List<TransactionOutput> getOutputs() { return getOutputs(true); }
@Override public List<AbstractOutput> getSentTo() { List<AbstractOutput> outputs = new ArrayList<>(); for (TransactionOutput output : getOutputs(false)) { try { AbstractAddress address = BitAddress.from(type, output.getScriptPubKey()); outputs.add(new AbstractOutput(address, type.value(output.getValue()))); } catch (Exception e) { /* ignore this output */ } } return outputs; }
private void setAppearedAtChainHeight(BitTransaction tx, int height, boolean updateUtxoSet) { checkState(lock.isHeldByCurrentThread(), "Lock is held by another thread"); tx.setAppearedAtChainHeight(height); fetchTimestamp(tx, height); // Update unspent outputs if (updateUtxoSet) { for (TransactionOutput output : tx.getOutputs(false)) { OutPointOutput unspentOutput = unspentOutputs.get(TrimmedOutPoint.get(output)); if (unspentOutput != null) { unspentOutput.setAppearedAtChainHeight(height); } } } }
List<TransactionOutput> outputs = tx.getOutputs(); for (int i = 0; i < outputs.size(); i++) { TransactionOutput output = outputs.get(i);
private void maybeUpdateBlockDepth(BitTransaction tx, boolean updateUtxoSet) { checkState(lock.isHeldByCurrentThread(), "Lock is held by another thread"); if (tx.getConfidenceType() != BUILDING) return; int newDepth = lastBlockSeenHeight - tx.getAppearedAtChainHeight() + 1; if (newDepth > 1) { tx.setDepthInBlocks(newDepth); // Update unspent outputs if (updateUtxoSet) { for (TransactionOutput output : tx.getOutputs(false)) { OutPointOutput unspentOutput = unspentOutputs.get(TrimmedOutPoint.get(output)); if (unspentOutput != null) { unspentOutput.setDepthInBlocks(newDepth); } } } } }
for (TransactionOutput txo : tx.getOutputs()) { if (txo.isAvailableForSpending() && txo.isMineOrWatched(account)) { OutPointOutput utxo = new OutPointOutput(tx, txo.getIndex());
for (int i = 0 ; i < tx.getOutputs(false).size() ; i++) { TransactionOutput output = tx.getOutputs().get(i); final Protos.TransactionOutput transactionOutput = txProto.getTransactionOutput(i);
@Nullable public Value getRawTxFee(TransactionWatcherWallet wallet) { checkState(!isTrimmed, "Cannot get raw tx fee from a trimmed transaction"); Value fee = type.value(0); for (TransactionInput input : tx.getInputs()) { TransactionOutPoint outPoint = input.getOutpoint(); BitTransaction inTx = wallet.getTransaction(outPoint.getHash()); if (inTx == null || !inTx.isOutputAvailable((int) outPoint.getIndex())) { return null; } TransactionOutput txo = inTx.getOutput((int) outPoint.getIndex()); fee = fee.add(txo.getValue()); } for (TransactionOutput output : getOutputs()) { fee = fee.subtract(output.getValue()); } return fee; }
BitTransaction txNew = checkNotNull(newPocket.getTransaction(tx.getHash())); assertInputsEquals(tx.getInputs(), txNew.getInputs()); assertOutputsEquals(tx.getOutputs(false), txNew.getOutputs(false));