3
0
mirror of https://github.com/Qortal/altcoinj.git synced 2025-01-31 07:12:17 +00:00

Remove the redundant Wallet.isTransactionRelevant(..., includeDoubleSpending) parameter, as it was always set to true.

This commit is contained in:
Mike Hearn 2012-12-14 16:24:24 +01:00
parent ca629e330f
commit f6a498c241
2 changed files with 9 additions and 10 deletions

View File

@ -512,7 +512,7 @@ public abstract class AbstractBlockChain {
List<Transaction> transactions, boolean clone) throws VerificationException { List<Transaction> transactions, boolean clone) throws VerificationException {
for (Transaction tx : transactions) { for (Transaction tx : transactions) {
try { try {
if (wallet.isTransactionRelevant(tx, true)) { if (wallet.isTransactionRelevant(tx)) {
if (clone) if (clone)
tx = new Transaction(tx.params, tx.bitcoinSerialize()); tx = new Transaction(tx.params, tx.bitcoinSerialize());
wallet.receiveFromBlock(tx, block, blockType); wallet.receiveFromBlock(tx, block, blockType);
@ -675,7 +675,7 @@ public abstract class AbstractBlockChain {
for (Transaction tx : block.transactions) { for (Transaction tx : block.transactions) {
try { try {
for (Wallet wallet : wallets) { for (Wallet wallet : wallets) {
if (wallet.isTransactionRelevant(tx, true)) return true; if (wallet.isTransactionRelevant(tx)) return true;
} }
} catch (ScriptException e) { } catch (ScriptException e) {
// We don't want scripts we don't understand to break the block chain so just note that this tx was // We don't want scripts we don't understand to break the block chain so just note that this tx was

View File

@ -629,7 +629,7 @@ public class Wallet implements Serializable {
// We only care about transactions that: // We only care about transactions that:
// - Send us coins // - Send us coins
// - Spend our coins // - Spend our coins
if (!isTransactionRelevant(tx, true)) { if (!isTransactionRelevant(tx)) {
log.debug("Received tx that isn't relevant to this wallet, discarding."); log.debug("Received tx that isn't relevant to this wallet, discarding.");
return; 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, * <p>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 * 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.<p> * not ours but which are spent by pending transactions.</p>
* *
* Note that if the tx has inputs containing one of our keys, but the connected transaction is not in the wallet, * <p>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. * it will not be considered relevant.</p>
*/ */
public synchronized boolean isTransactionRelevant(Transaction tx, public synchronized boolean isTransactionRelevant(Transaction tx) throws ScriptException {
boolean includeDoubleSpending) throws ScriptException {
return tx.getValueSentFromMe(this).compareTo(BigInteger.ZERO) > 0 || return tx.getValueSentFromMe(this).compareTo(BigInteger.ZERO) > 0 ||
tx.getValueSentToMe(this).compareTo(BigInteger.ZERO) > 0 || tx.getValueSentToMe(this).compareTo(BigInteger.ZERO) > 0 ||
(includeDoubleSpending && (findDoubleSpendAgainstPending(tx) != null)); findDoubleSpendAgainstPending(tx) != null;
} }
/** /**