From fe3828e21f6f64c9e9cf26110babd7745a745547 Mon Sep 17 00:00:00 2001 From: chimp1984 Date: Wed, 14 Oct 2020 10:13:12 -0500 Subject: [PATCH 1/2] Dont include dead transactions in check for unconfirmed txs chain --- core/src/main/java/bisq/core/btc/wallet/WalletService.java | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/core/src/main/java/bisq/core/btc/wallet/WalletService.java b/core/src/main/java/bisq/core/btc/wallet/WalletService.java index 920df501e82..7ef84c7c6a6 100644 --- a/core/src/main/java/bisq/core/btc/wallet/WalletService.java +++ b/core/src/main/java/bisq/core/btc/wallet/WalletService.java @@ -62,12 +62,9 @@ import org.bitcoinj.wallet.DecryptingKeyBag; import org.bitcoinj.wallet.DeterministicSeed; import org.bitcoinj.wallet.KeyBag; -import org.bitcoinj.wallet.KeyChain; import org.bitcoinj.wallet.RedeemData; import org.bitcoinj.wallet.SendRequest; 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.WalletCoinsReceivedEventListener; import org.bitcoinj.wallet.listeners.WalletCoinsSentEventListener; @@ -635,7 +632,9 @@ public int getLastBlockSeenHeight() { * @return true when queue is full */ public boolean isUnconfirmedTransactionsLimitHit() { - return 20 < getTransactions(true).stream().filter(transaction -> transaction.isPending()).count(); + return 20 < getTransactions(false).stream() + .filter(Transaction::isPending) + .count(); } public Set getTransactions(boolean includeDead) { From 8b404e195459c1a34cc9dd2151c96a2e53a2be7e Mon Sep 17 00:00:00 2001 From: chimp1984 Date: Wed, 14 Oct 2020 20:17:48 -0500 Subject: [PATCH 2/2] Exclude time-locked txs at isUnconfirmedTransactionsLimitHit For published delayed payout transactions we do not receive the tx confidence so we cannot check if it is confirmed so we ignore it for that check. The check is any arbitrarily using a limit of 20, so we don't need to be exact here. Should just reduce the likelihood of issues with the too long chains of unconfirmed transactions. --- .../main/java/bisq/core/btc/wallet/WalletService.java | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/core/src/main/java/bisq/core/btc/wallet/WalletService.java b/core/src/main/java/bisq/core/btc/wallet/WalletService.java index 7ef84c7c6a6..251aac97172 100644 --- a/core/src/main/java/bisq/core/btc/wallet/WalletService.java +++ b/core/src/main/java/bisq/core/btc/wallet/WalletService.java @@ -632,9 +632,14 @@ public int getLastBlockSeenHeight() { * @return true when queue is full */ public boolean isUnconfirmedTransactionsLimitHit() { - return 20 < getTransactions(false).stream() + // For published delayed payout transactions we do not receive the tx confidence + // so we cannot check if it is confirmed so we ignore it for that check. The check is any arbitrarily + // using a limit of 20, so we don't need to be exact here. Should just reduce the likelihood of issues with + // the too long chains of unconfirmed transactions. + return getTransactions(false).stream() + .filter(tx -> tx.getLockTime() == 0) .filter(Transaction::isPending) - .count(); + .count() > 20; } public Set getTransactions(boolean includeDead) {