From 85c80bcd5cb292cfa113c57b1b0b1f6ef615d5a1 Mon Sep 17 00:00:00 2001 From: Manfred Karrer Date: Sun, 7 Oct 2018 17:40:01 -0500 Subject: [PATCH 1/2] Remove the maybeCommitTx call at timeout --- .../main/java/bisq/core/btc/wallet/TxBroadcaster.java | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/core/src/main/java/bisq/core/btc/wallet/TxBroadcaster.java b/core/src/main/java/bisq/core/btc/wallet/TxBroadcaster.java index 80870329f1b..07c6e5a8ac6 100644 --- a/core/src/main/java/bisq/core/btc/wallet/TxBroadcaster.java +++ b/core/src/main/java/bisq/core/btc/wallet/TxBroadcaster.java @@ -48,8 +48,7 @@ public interface Callback { default void onTimeout(TxBroadcastTimeoutException exception) { Transaction tx = exception.getLocalTx(); if (tx != null) { - String txId = tx.getHashAsString(); - log.warn("TxBroadcaster.onTimeout called: {}\n" + + log.warn("TxBroadcaster.onTimeout called: {} \n" + "We optimistically assume that the tx broadcast succeeds later and call onSuccess on the " + "callback handler. This behaviour carries less potential problems than if we would trigger " + "a failure (e.g. which would cause a failed create offer attempt of failed take offer attempt).\n" + @@ -72,7 +71,11 @@ default void onTimeout(TxBroadcastTimeoutException exception) { // inconsistency if the tx was committed twice. It should be prevented by the maybeCommitTx methods but // not 100% if that is always the case. Just added that comment to make clear that this might be a risky // strategy and might need improvement if we get problems. - exception.getWallet().maybeCommitTx(tx); + // UPDATE: We got reported an wallet problem that a tx was added twice and wallet could not be loaded anymore even after a SPV resync. + // So it seems that this trategy is too risky to cause more problems as it tries to solve. + // Need more work from a BitcoinJ expert! For now we comment the call out here but leave it as reference + // for future improvements. + // exception.getWallet().maybeCommitTx(tx); onSuccess(tx); } else { From be1f177fc787ed0d2ec553aac396dce5053b5399 Mon Sep 17 00:00:00 2001 From: Manfred Karrer Date: Sun, 7 Oct 2018 17:40:44 -0500 Subject: [PATCH 2/2] Increase timeout to 30 sec --- core/src/main/java/bisq/core/btc/wallet/TxBroadcaster.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/src/main/java/bisq/core/btc/wallet/TxBroadcaster.java b/core/src/main/java/bisq/core/btc/wallet/TxBroadcaster.java index 07c6e5a8ac6..e39985d047b 100644 --- a/core/src/main/java/bisq/core/btc/wallet/TxBroadcaster.java +++ b/core/src/main/java/bisq/core/btc/wallet/TxBroadcaster.java @@ -92,7 +92,7 @@ default void onTxMalleability(TxMalleabilityException exception) { void onFailure(TxBroadcastException exception); } - private static final int DEFAULT_BROADCAST_TIMEOUT = 20; + private static final int DEFAULT_BROADCAST_TIMEOUT = 30; private static Map broadcastTimerMap = new HashMap<>(); public static void broadcastTx(Wallet wallet, PeerGroup peerGroup, Transaction localTx, Callback callback) {