Dont include dead transactions in check for unconfirmed txs chain

This commit is contained in:
chimp1984 2020-10-14 10:13:12 -05:00
parent 58f5066e0a
commit fe3828e21f
No known key found for this signature in database
GPG Key ID: 9801B4EC591F90E3

View File

@ -62,12 +62,9 @@ import org.bitcoinj.utils.Threading;
import org.bitcoinj.wallet.DecryptingKeyBag; import org.bitcoinj.wallet.DecryptingKeyBag;
import org.bitcoinj.wallet.DeterministicSeed; import org.bitcoinj.wallet.DeterministicSeed;
import org.bitcoinj.wallet.KeyBag; import org.bitcoinj.wallet.KeyBag;
import org.bitcoinj.wallet.KeyChain;
import org.bitcoinj.wallet.RedeemData; import org.bitcoinj.wallet.RedeemData;
import org.bitcoinj.wallet.SendRequest; import org.bitcoinj.wallet.SendRequest;
import org.bitcoinj.wallet.Wallet; import org.bitcoinj.wallet.Wallet;
import org.bitcoinj.wallet.listeners.KeyChainEventListener;
import org.bitcoinj.wallet.listeners.ScriptsChangeEventListener;
import org.bitcoinj.wallet.listeners.WalletChangeEventListener; import org.bitcoinj.wallet.listeners.WalletChangeEventListener;
import org.bitcoinj.wallet.listeners.WalletCoinsReceivedEventListener; import org.bitcoinj.wallet.listeners.WalletCoinsReceivedEventListener;
import org.bitcoinj.wallet.listeners.WalletCoinsSentEventListener; import org.bitcoinj.wallet.listeners.WalletCoinsSentEventListener;
@ -635,7 +632,9 @@ public abstract class WalletService {
* @return true when queue is full * @return true when queue is full
*/ */
public boolean isUnconfirmedTransactionsLimitHit() { public boolean isUnconfirmedTransactionsLimitHit() {
return 20 < getTransactions(true).stream().filter(transaction -> transaction.isPending()).count(); return 20 < getTransactions(false).stream()
.filter(Transaction::isPending)
.count();
} }
public Set<Transaction> getTransactions(boolean includeDead) { public Set<Transaction> getTransactions(boolean includeDead) {