public TransactionWrapper(Transaction transaction, TransactionBag transactionBag, boolean isInstant) { this.transaction = transaction; this.amount = transaction.getValue(transactionBag); this.isInstant = isInstant; }
private BitTransaction getTrimTransaction(TransactionBag wallet) { throw new RuntimeException(); // BitTransaction transaction = rawTransactions.get(hash); // // if (transaction == null || transaction.isTrimmed()) return false; // // final Value valueSent = transaction.getValueSent(this); // final Value valueReceived = transaction.getValueReceived(this); // final Value fee = transaction.getFee(); // // WalletTransaction.Pool txPool; // if (confirmed.containsKey(hash)) { // txPool = WalletTransaction.Pool.CONFIRMED; // } else if (pending.containsKey(hash)) { // txPool = WalletTransaction.Pool.PENDING; // } else { // throw new RuntimeException("Transaction is not found in any pool"); // } // // Transaction txFull = transaction.getRawTransaction(); // Transaction tx = new Transaction(type); // tx.getConfidence().setSource(txFull.getConfidence().getSource()); // tx.getConfidence().setConfidenceType(txFull.getConfidence().getConfidenceType()); // if (tx.getConfidence().getConfidenceType() == BUILDING) { // tx.getConfidence().setAppearedAtChainHeight(txFull.getConfidence().getAppearedAtChainHeight()); // tx.getConfidence().setDepthInBlocks(txFull.getConfidence().getDepthInBlocks()); // } // tx.setTime(txFull.getTime()); // tx.setTokenId(txFull.getTokenId()); // tx.setExtraBytes(txFull.getExtraBytes()); // tx.setUpdateTime(txFull.getUpdateTime()); // tx.setLockTime(txFull.getLockTime()); // // if (txFull.getAppearsInHashes() != null) { // for (Map.Entry<Sha256Hash, Integer> appears : txFull.getAppearsInHashes().entrySet()) { // tx.addBlockAppearance(appears.getKey(), appears.getValue()); // } // } // // tx.setPurpose(txFull.getPurpose()); // // // Remove unrelated outputs when receiving coins // boolean isReceiving = valueReceived.compareTo(valueSent) > 0; // if (isReceiving) { // for (TransactionOutput output : txFull.getOutputs()) { // if (output.isMineOrWatched(this)) { // tx.addOutput(output); // } // } // } else { // // When sending keep all outputs // for (TransactionOutput output : txFull.getOutputs()) { // tx.addOutput(output); // } // } // // return BitTransaction.fromTrimmed(hash, tx, valueSent, valueReceived, fee); }