3
0
mirror of https://github.com/Qortal/altcoinj.git synced 2025-01-30 23:02:15 +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 {
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

View File

@ -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,
* <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
* 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,
* it will not be considered relevant.
* <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.</p>
*/
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;
}
/**