diff --git a/core/src/main/java/com/google/bitcoin/core/AbstractBlockChain.java b/core/src/main/java/com/google/bitcoin/core/AbstractBlockChain.java index 3d1f57c1..4ecb10d5 100644 --- a/core/src/main/java/com/google/bitcoin/core/AbstractBlockChain.java +++ b/core/src/main/java/com/google/bitcoin/core/AbstractBlockChain.java @@ -512,7 +512,7 @@ public abstract class AbstractBlockChain { List transactions, boolean clone) throws VerificationException { for (Transaction tx : transactions) { try { - if (wallet.isTransactionRelevant(tx, true)) { + if (wallet.isTransactionRelevant(tx)) { if (clone) tx = new Transaction(tx.params, tx.bitcoinSerialize()); wallet.receiveFromBlock(tx, block, blockType); @@ -675,7 +675,7 @@ public abstract class AbstractBlockChain { for (Transaction tx : block.transactions) { try { for (Wallet wallet : wallets) { - if (wallet.isTransactionRelevant(tx, true)) return true; + if (wallet.isTransactionRelevant(tx)) return true; } } catch (ScriptException e) { // We don't want scripts we don't understand to break the block chain so just note that this tx was diff --git a/core/src/main/java/com/google/bitcoin/core/Wallet.java b/core/src/main/java/com/google/bitcoin/core/Wallet.java index 053a7dee..5e8304ae 100644 --- a/core/src/main/java/com/google/bitcoin/core/Wallet.java +++ b/core/src/main/java/com/google/bitcoin/core/Wallet.java @@ -629,7 +629,7 @@ public class Wallet implements Serializable { // We only care about transactions that: // - Send us coins // - Spend our coins - if (!isTransactionRelevant(tx, true)) { + if (!isTransactionRelevant(tx)) { log.debug("Received tx that isn't relevant to this wallet, discarding."); return; } @@ -679,18 +679,17 @@ public class Wallet implements Serializable { } /** - * Returns true if the given transaction sends coins to any of our keys, or has inputs spending any of our outputs, + *

Returns true if the given transaction sends coins to any of our keys, or has inputs spending any of our outputs, * and if includeDoubleSpending is true, also returns true if tx has inputs that are spending outputs which are - * not ours but which are spent by pending transactions.

+ * not ours but which are spent by pending transactions.

* - * Note that if the tx has inputs containing one of our keys, but the connected transaction is not in the wallet, - * it will not be considered relevant. + *

Note that if the tx has inputs containing one of our keys, but the connected transaction is not in the wallet, + * it will not be considered relevant.

*/ - public synchronized boolean isTransactionRelevant(Transaction tx, - boolean includeDoubleSpending) throws ScriptException { + public synchronized boolean isTransactionRelevant(Transaction tx) throws ScriptException { return tx.getValueSentFromMe(this).compareTo(BigInteger.ZERO) > 0 || tx.getValueSentToMe(this).compareTo(BigInteger.ZERO) > 0 || - (includeDoubleSpending && (findDoubleSpendAgainstPending(tx) != null)); + findDoubleSpendAgainstPending(tx) != null; } /**