From 349bd13c0d466e595ca1b9c673144366771e6758 Mon Sep 17 00:00:00 2001 From: chimp1984 Date: Sun, 13 Sep 2020 13:06:22 -0500 Subject: [PATCH 1/8] Set always uid from tradeMessage Seems in the past there was partial support for uid but now all trade messages have uid. --- .../core/trade/protocol/TradeProtocol.java | 19 +++++-------------- 1 file changed, 5 insertions(+), 14 deletions(-) diff --git a/core/src/main/java/bisq/core/trade/protocol/TradeProtocol.java b/core/src/main/java/bisq/core/trade/protocol/TradeProtocol.java index c561b242741..f2ac569ea43 100644 --- a/core/src/main/java/bisq/core/trade/protocol/TradeProtocol.java +++ b/core/src/main/java/bisq/core/trade/protocol/TradeProtocol.java @@ -21,7 +21,6 @@ import bisq.core.trade.Trade; import bisq.core.trade.TradeManager; import bisq.core.trade.messages.CounterCurrencyTransferStartedMessage; -import bisq.core.trade.messages.InputsForDepositTxRequest; import bisq.core.trade.messages.MediatedPayoutTxPublishedMessage; import bisq.core.trade.messages.MediatedPayoutTxSignatureMessage; import bisq.core.trade.messages.PeerPublishedDelayedPayoutTxMessage; @@ -357,15 +356,8 @@ private void sendAckMessage(@Nullable TradeMessage tradeMessage, boolean result, return; String tradeId = tradeMessage.getTradeId(); - String sourceUid = ""; - if (tradeMessage instanceof MailboxMessage) { - sourceUid = ((MailboxMessage) tradeMessage).getUid(); - } else { - // For direct msg we don't have a mandatory uid so we need to cast to get it - if (tradeMessage instanceof InputsForDepositTxRequest) { - sourceUid = tradeMessage.getUid(); - } - } + String sourceUid = tradeMessage.getUid(); + AckMessage ackMessage = new AckMessage(processModel.getMyNodeAddress(), AckMessageSourceType.TRADE_MESSAGE, tradeMessage.getClass().getSimpleName(), @@ -378,7 +370,6 @@ private void sendAckMessage(@Nullable TradeMessage tradeMessage, boolean result, final NodeAddress peersNodeAddress = trade.getTradingPeerNodeAddress() != null ? trade.getTradingPeerNodeAddress() : processModel.getTempTradingPeerNodeAddress(); log.info("Send AckMessage for {} to peer {}. tradeId={}, sourceUid={}", ackMessage.getSourceMsgClassName(), peersNodeAddress, tradeId, sourceUid); - String finalSourceUid = sourceUid; processModel.getP2PService().sendEncryptedMailboxMessage( peersNodeAddress, processModel.getTradingPeer().getPubKeyRing(), @@ -387,19 +378,19 @@ private void sendAckMessage(@Nullable TradeMessage tradeMessage, boolean result, @Override public void onArrived() { log.info("AckMessage for {} arrived at peer {}. tradeId={}, sourceUid={}", - ackMessage.getSourceMsgClassName(), peersNodeAddress, tradeId, finalSourceUid); + ackMessage.getSourceMsgClassName(), peersNodeAddress, tradeId, sourceUid); } @Override public void onStoredInMailbox() { log.info("AckMessage for {} stored in mailbox for peer {}. tradeId={}, sourceUid={}", - ackMessage.getSourceMsgClassName(), peersNodeAddress, tradeId, finalSourceUid); + ackMessage.getSourceMsgClassName(), peersNodeAddress, tradeId, sourceUid); } @Override public void onFault(String errorMessage) { log.error("AckMessage for {} failed. Peer {}. tradeId={}, sourceUid={}, errorMessage={}", - ackMessage.getSourceMsgClassName(), peersNodeAddress, tradeId, finalSourceUid, errorMessage); + ackMessage.getSourceMsgClassName(), peersNodeAddress, tradeId, sourceUid, errorMessage); } } ); From e77068439703ef40a2fc14291f8496755eeb1440 Mon Sep 17 00:00:00 2001 From: chimp1984 Date: Sun, 13 Sep 2020 13:23:07 -0500 Subject: [PATCH 2/8] Add log to see better bisq start in log files --- core/src/main/java/bisq/core/setup/CoreSetup.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/core/src/main/java/bisq/core/setup/CoreSetup.java b/core/src/main/java/bisq/core/setup/CoreSetup.java index 68a77a66709..3480d1316fc 100644 --- a/core/src/main/java/bisq/core/setup/CoreSetup.java +++ b/core/src/main/java/bisq/core/setup/CoreSetup.java @@ -58,7 +58,10 @@ public static void setup(Config config) { private static void setupLog(Config config) { String logPath = Paths.get(config.appDataDir.getPath(), "bisq").toString(); Log.setup(logPath); - log.info("\n\n\nLog files under: " + logPath); + log.info("\n\n\n///////////////////////////////////////////////////////////////////////////////////////////"); + log.info("\n// BISQ STARTED ///////////////////////////////////////////////////////////////////////////"); + log.info("\n///////////////////////////////////////////////////////////////////////////////////////////"); + log.info("\n\nLog files under: {}", logPath); Utilities.printSysInfo(); Log.setLevel(Level.toLevel(config.logLevel)); } From dea56d09036c8209b4337730af454372902ba5fa Mon Sep 17 00:00:00 2001 From: chimp1984 Date: Sun, 13 Sep 2020 13:41:47 -0500 Subject: [PATCH 3/8] Increase timouts --- .../src/main/java/bisq/core/trade/protocol/TradeProtocol.java | 2 +- p2p/src/main/java/bisq/network/http/HttpClientImpl.java | 4 ++-- .../bisq/network/p2p/peers/getdata/GetDataRequestHandler.java | 2 +- .../p2p/peers/peerexchange/GetPeersRequestHandler.java | 2 +- .../network/p2p/peers/peerexchange/PeerExchangeHandler.java | 2 +- 5 files changed, 6 insertions(+), 6 deletions(-) diff --git a/core/src/main/java/bisq/core/trade/protocol/TradeProtocol.java b/core/src/main/java/bisq/core/trade/protocol/TradeProtocol.java index f2ac569ea43..9b056672d92 100644 --- a/core/src/main/java/bisq/core/trade/protocol/TradeProtocol.java +++ b/core/src/main/java/bisq/core/trade/protocol/TradeProtocol.java @@ -65,7 +65,7 @@ @Slf4j public abstract class TradeProtocol { - private static final long TIMEOUT = 90; + private static final long TIMEOUT = 180; protected final ProcessModel processModel; private final DecryptedDirectMessageListener decryptedDirectMessageListener; diff --git a/p2p/src/main/java/bisq/network/http/HttpClientImpl.java b/p2p/src/main/java/bisq/network/http/HttpClientImpl.java index e85c7e7efff..8c298b83c41 100644 --- a/p2p/src/main/java/bisq/network/http/HttpClientImpl.java +++ b/p2p/src/main/java/bisq/network/http/HttpClientImpl.java @@ -123,8 +123,8 @@ public String requestWithGETNoProxy(String param, try { connection = (HttpURLConnection) url.openConnection(); connection.setRequestMethod("GET"); - connection.setConnectTimeout((int) TimeUnit.SECONDS.toMillis(30)); - connection.setReadTimeout((int) TimeUnit.SECONDS.toMillis(30)); + connection.setConnectTimeout((int) TimeUnit.SECONDS.toMillis(120)); + connection.setReadTimeout((int) TimeUnit.SECONDS.toMillis(120)); connection.setRequestProperty("User-Agent", "bisq/" + Version.VERSION); if (headerKey != null && headerValue != null) connection.setRequestProperty(headerKey, headerValue); diff --git a/p2p/src/main/java/bisq/network/p2p/peers/getdata/GetDataRequestHandler.java b/p2p/src/main/java/bisq/network/p2p/peers/getdata/GetDataRequestHandler.java index bb2c4949f9f..23741347542 100644 --- a/p2p/src/main/java/bisq/network/p2p/peers/getdata/GetDataRequestHandler.java +++ b/p2p/src/main/java/bisq/network/p2p/peers/getdata/GetDataRequestHandler.java @@ -40,7 +40,7 @@ @Slf4j public class GetDataRequestHandler { - private static final long TIMEOUT = 90; + private static final long TIMEOUT = 180; private static final int MAX_ENTRIES = 10000; diff --git a/p2p/src/main/java/bisq/network/p2p/peers/peerexchange/GetPeersRequestHandler.java b/p2p/src/main/java/bisq/network/p2p/peers/peerexchange/GetPeersRequestHandler.java index d9f627f8291..5dcac384d97 100644 --- a/p2p/src/main/java/bisq/network/p2p/peers/peerexchange/GetPeersRequestHandler.java +++ b/p2p/src/main/java/bisq/network/p2p/peers/peerexchange/GetPeersRequestHandler.java @@ -42,7 +42,7 @@ @Slf4j class GetPeersRequestHandler { // We want to keep timeout short here - private static final long TIMEOUT = 40; + private static final long TIMEOUT = 90; /////////////////////////////////////////////////////////////////////////////////////////// diff --git a/p2p/src/main/java/bisq/network/p2p/peers/peerexchange/PeerExchangeHandler.java b/p2p/src/main/java/bisq/network/p2p/peers/peerexchange/PeerExchangeHandler.java index e8d9c08bc0e..9f8fb409b33 100644 --- a/p2p/src/main/java/bisq/network/p2p/peers/peerexchange/PeerExchangeHandler.java +++ b/p2p/src/main/java/bisq/network/p2p/peers/peerexchange/PeerExchangeHandler.java @@ -46,7 +46,7 @@ @Slf4j class PeerExchangeHandler implements MessageListener { // We want to keep timeout short here - private static final long TIMEOUT = 40; + private static final long TIMEOUT = 90; private static final int DELAY_MS = 500; From 06703f97c211d410bc8fb48df6486d74d51b31eb Mon Sep 17 00:00:00 2001 From: chimp1984 Date: Sun, 13 Sep 2020 14:17:25 -0500 Subject: [PATCH 4/8] Add bisq ascii logo at start --- .../main/java/bisq/core/app/AsciiLogo.java | 52 +++++++++++++++++++ .../java/bisq/core/app/BisqExecutable.java | 1 + .../main/java/bisq/core/setup/CoreSetup.java | 5 +- 3 files changed, 54 insertions(+), 4 deletions(-) create mode 100644 core/src/main/java/bisq/core/app/AsciiLogo.java diff --git a/core/src/main/java/bisq/core/app/AsciiLogo.java b/core/src/main/java/bisq/core/app/AsciiLogo.java new file mode 100644 index 00000000000..efe38f71a34 --- /dev/null +++ b/core/src/main/java/bisq/core/app/AsciiLogo.java @@ -0,0 +1,52 @@ +/* + * This file is part of Bisq. + * + * Bisq is free software: you can redistribute it and/or modify it + * under the terms of the GNU Affero General Public License as published by + * the Free Software Foundation, either version 3 of the License, or (at + * your option) any later version. + * + * Bisq is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public + * License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with Bisq. If not, see . + */ + +package bisq.core.app; + +import lombok.extern.slf4j.Slf4j; + +@Slf4j +public class AsciiLogo { + public static void show() { + log.info("\n\n" + + " \n" + + " ```` \n" + + " .-/+oooooo+:. `:::::- \n" + + " ./+ooooooooooooo+. .ooooo/ \n" + + " `-+oooooooooooooooooo .ooooo/ \n" + + " -+oooo:--/oooooooooooo `.` .ooooo/ \n" + + " /ooooo/ `-/ooooooo/. `:+o+. .ooooo/ `.----..` `.....` `.--::--.` `.--::--.` \n" + + " /oooooo` `-:/:-. `:oooooo. .ooooo+/+oooooooo+/-` :ooooo: ./+oooooooo+/. .:+oooooooooo+:` \n" + + " :oooooo- `+ooooooo+` .oooooooooooooooooooo:` :ooooo: :ooooooooooooo+. .+oooooooooooooooo/` \n" + + " `oooooo+ `+oooooooo+ .oooooooo+/:--:/+ooooo+. :ooooo: -ooooo+-..-/o/-` :oooooo/:---:/+ooooo+. \n" + + " :oooooo: .-/+oooo+ .ooooooo-` `-oooooo` :ooooo: /ooooo- ` -ooooo+. `-oooooo` \n" + + " :oooooo. ```` ```` ``...` .oooooo. -ooooo/ :ooooo: .oooooo+/::-.` oooooo` -ooooo/ \n" + + " :oooooo` /ooo: :+oo+ .ooooo/ ooooo+ :ooooo: .+oooooooooo+/. .ooooo/ ooooo+ \n" + + " .oooooo- ./oo/ /oo/. `ooooo/ `ooooo+ :ooooo: `.:++ooooooooo/ `ooooo/ `oooooo \n" + + " +oooooo. `` `` +ooooo. :ooooo: :ooooo: `..-:+ooooo: +ooooo. `/oooooo \n" + + " `+oooooo-` `::::` `.:/:` .oooooo:` `:ooooo+` :ooooo: `-+:` -ooooo/ .oooooo:` `.+ooooooo \n" + + " .+oooooo+:` -++- `.:+oooo: .+oooooo+//:/+oooooo/` :ooooo: -+oooo+/::/oooooo. .+oooooo+////+ooooooooo \n" + + " `/oooooooo/-` `.:+oooooo+` `:+oooooooooooooo+- :ooooo: `/ooooooooooooo+. `:+ooooooooooooooooooo \n" + + " -+ooooooooo/:..`..-/+ooooooo+- `-:+ooooooo++:. -+ooo+- .:+ooooooo+/. `.:++oooooo+:-oooooo \n" + + " ./oooooooooooooooooooooo/- ``....` ````` ``....` ``..`` oooooo \n" + + " `.:+oooooooooooooo+:-` oooooo \n" + + " `.--::::--..` oooooo \n" + + " oooooo \n" + + " .----. " + + "\n\n"); + } +} diff --git a/core/src/main/java/bisq/core/app/BisqExecutable.java b/core/src/main/java/bisq/core/app/BisqExecutable.java index bb36e1ffe49..61d305988dc 100644 --- a/core/src/main/java/bisq/core/app/BisqExecutable.java +++ b/core/src/main/java/bisq/core/app/BisqExecutable.java @@ -102,6 +102,7 @@ public void execute(String[] args) { /////////////////////////////////////////////////////////////////////////////////////////// protected void doExecute() { + AsciiLogo.show(); configUserThread(); CoreSetup.setup(config); addCapabilities(); diff --git a/core/src/main/java/bisq/core/setup/CoreSetup.java b/core/src/main/java/bisq/core/setup/CoreSetup.java index 3480d1316fc..9265539af42 100644 --- a/core/src/main/java/bisq/core/setup/CoreSetup.java +++ b/core/src/main/java/bisq/core/setup/CoreSetup.java @@ -58,10 +58,7 @@ public static void setup(Config config) { private static void setupLog(Config config) { String logPath = Paths.get(config.appDataDir.getPath(), "bisq").toString(); Log.setup(logPath); - log.info("\n\n\n///////////////////////////////////////////////////////////////////////////////////////////"); - log.info("\n// BISQ STARTED ///////////////////////////////////////////////////////////////////////////"); - log.info("\n///////////////////////////////////////////////////////////////////////////////////////////"); - log.info("\n\nLog files under: {}", logPath); + log.info("Log files under: {}", logPath); Utilities.printSysInfo(); Log.setLevel(Level.toLevel(config.logLevel)); } From 296506fb476cef58859c62f83abb85d16415ae41 Mon Sep 17 00:00:00 2001 From: chimp1984 Date: Sun, 13 Sep 2020 14:50:16 -0500 Subject: [PATCH 5/8] Update ascii logo --- .../main/java/bisq/core/app/AsciiLogo.java | 44 ++++++++----------- .../java/bisq/core/app/BisqExecutable.java | 2 +- 2 files changed, 20 insertions(+), 26 deletions(-) diff --git a/core/src/main/java/bisq/core/app/AsciiLogo.java b/core/src/main/java/bisq/core/app/AsciiLogo.java index efe38f71a34..f8d30333ddb 100644 --- a/core/src/main/java/bisq/core/app/AsciiLogo.java +++ b/core/src/main/java/bisq/core/app/AsciiLogo.java @@ -21,32 +21,26 @@ @Slf4j public class AsciiLogo { - public static void show() { + public static void showAsciiLogo() { log.info("\n\n" + - " \n" + - " ```` \n" + - " .-/+oooooo+:. `:::::- \n" + - " ./+ooooooooooooo+. .ooooo/ \n" + - " `-+oooooooooooooooooo .ooooo/ \n" + - " -+oooo:--/oooooooooooo `.` .ooooo/ \n" + - " /ooooo/ `-/ooooooo/. `:+o+. .ooooo/ `.----..` `.....` `.--::--.` `.--::--.` \n" + - " /oooooo` `-:/:-. `:oooooo. .ooooo+/+oooooooo+/-` :ooooo: ./+oooooooo+/. .:+oooooooooo+:` \n" + - " :oooooo- `+ooooooo+` .oooooooooooooooooooo:` :ooooo: :ooooooooooooo+. .+oooooooooooooooo/` \n" + - " `oooooo+ `+oooooooo+ .oooooooo+/:--:/+ooooo+. :ooooo: -ooooo+-..-/o/-` :oooooo/:---:/+ooooo+. \n" + - " :oooooo: .-/+oooo+ .ooooooo-` `-oooooo` :ooooo: /ooooo- ` -ooooo+. `-oooooo` \n" + - " :oooooo. ```` ```` ``...` .oooooo. -ooooo/ :ooooo: .oooooo+/::-.` oooooo` -ooooo/ \n" + - " :oooooo` /ooo: :+oo+ .ooooo/ ooooo+ :ooooo: .+oooooooooo+/. .ooooo/ ooooo+ \n" + - " .oooooo- ./oo/ /oo/. `ooooo/ `ooooo+ :ooooo: `.:++ooooooooo/ `ooooo/ `oooooo \n" + - " +oooooo. `` `` +ooooo. :ooooo: :ooooo: `..-:+ooooo: +ooooo. `/oooooo \n" + - " `+oooooo-` `::::` `.:/:` .oooooo:` `:ooooo+` :ooooo: `-+:` -ooooo/ .oooooo:` `.+ooooooo \n" + - " .+oooooo+:` -++- `.:+oooo: .+oooooo+//:/+oooooo/` :ooooo: -+oooo+/::/oooooo. .+oooooo+////+ooooooooo \n" + - " `/oooooooo/-` `.:+oooooo+` `:+oooooooooooooo+- :ooooo: `/ooooooooooooo+. `:+ooooooooooooooooooo \n" + - " -+ooooooooo/:..`..-/+ooooooo+- `-:+ooooooo++:. -+ooo+- .:+ooooooo+/. `.:++oooooo+:-oooooo \n" + - " ./oooooooooooooooooooooo/- ``....` ````` ``....` ``..`` oooooo \n" + - " `.:+oooooooooooooo+:-` oooooo \n" + - " `.--::::--..` oooooo \n" + - " oooooo \n" + - " .----. " + + " ........ ...... \n" + + " .............. ...... \n" + + " ................. ...... \n" + + " ...... .......... .. ...... \n" + + " ...... ...... ...... ............... ..... ......... .......... \n" + + " ....... ........ .................. ..... ............. ............... \n" + + " ...... ........ .......... ....... ..... ...... ... ........ ....... \n" + + " ...... ..... ....... ..... ..... ..... ..... ...... \n" + + " ...... ... ... ...... ...... ..... ........... ...... ...... \n" + + " ...... ..... .... ...... ...... ..... ............ ..... ...... \n" + + " ...... ..... ...... ..... ........ ...... ...... \n" + + " ...... .... ... ...... ...... ..... .. ...... ...... ........ \n" + + " ........ .. ....... ................. ..... .............. ................... \n" + + " .......... ......... ............. ..... ............ ................. \n" + + " ...................... ..... .... .... ...... \n" + + " ................ ...... \n" + + " .... ...... \n" + + " ...... \n" + "\n\n"); } } diff --git a/core/src/main/java/bisq/core/app/BisqExecutable.java b/core/src/main/java/bisq/core/app/BisqExecutable.java index 61d305988dc..f9961adda23 100644 --- a/core/src/main/java/bisq/core/app/BisqExecutable.java +++ b/core/src/main/java/bisq/core/app/BisqExecutable.java @@ -102,7 +102,7 @@ public void execute(String[] args) { /////////////////////////////////////////////////////////////////////////////////////////// protected void doExecute() { - AsciiLogo.show(); + AsciiLogo.showAsciiLogo(); configUserThread(); CoreSetup.setup(config); addCapabilities(); From f9f981fb6503b326d382c5206eed2e8144a893b6 Mon Sep 17 00:00:00 2001 From: chimp1984 Date: Sun, 13 Sep 2020 15:34:20 -0500 Subject: [PATCH 6/8] Improve state handling --- .../buyer/BuyerProcessDepositTxAndDelayedPayoutTxMessage.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/src/main/java/bisq/core/trade/protocol/tasks/buyer/BuyerProcessDepositTxAndDelayedPayoutTxMessage.java b/core/src/main/java/bisq/core/trade/protocol/tasks/buyer/BuyerProcessDepositTxAndDelayedPayoutTxMessage.java index e95960e043f..16be554fed3 100644 --- a/core/src/main/java/bisq/core/trade/protocol/tasks/buyer/BuyerProcessDepositTxAndDelayedPayoutTxMessage.java +++ b/core/src/main/java/bisq/core/trade/protocol/tasks/buyer/BuyerProcessDepositTxAndDelayedPayoutTxMessage.java @@ -70,7 +70,7 @@ protected void run() { processModel.removeMailboxMessageAfterProcessing(trade); // If we got already the confirmation we don't want to apply an earlier state - if (trade.getState() != Trade.State.BUYER_SAW_DEPOSIT_TX_IN_NETWORK) + if (trade.getState().ordinal() < Trade.State.BUYER_SAW_DEPOSIT_TX_IN_NETWORK.ordinal()) trade.setState(Trade.State.BUYER_RECEIVED_DEPOSIT_TX_PUBLISHED_MSG); processModel.getBtcWalletService().swapTradeEntryToAvailableEntry(trade.getId(), AddressEntry.Context.RESERVED_FOR_TRADE); From 19021ebcd7ccf9c2a9619942ecc9afdf268435c2 Mon Sep 17 00:00:00 2001 From: chimp1984 Date: Sun, 13 Sep 2020 15:35:06 -0500 Subject: [PATCH 7/8] Use 1 sec timeout for bsq trade fee txs --- .../bisq/core/btc/wallet/TxBroadcaster.java | 12 +++-- .../bisq/core/btc/wallet/WalletService.java | 5 +- .../bisq/core/btc/wallet/WalletsManager.java | 6 ++- .../placeoffer/tasks/CreateMakerFeeTx.java | 54 ++++++++++--------- .../tasks/taker/TakerPublishFeeTx.java | 4 +- 5 files changed, 46 insertions(+), 35 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 37eb40a14b8..8e8e7f6cfb8 100644 --- a/core/src/main/java/bisq/core/btc/wallet/TxBroadcaster.java +++ b/core/src/main/java/bisq/core/btc/wallet/TxBroadcaster.java @@ -77,22 +77,24 @@ default void onTimeout(TxBroadcastTimeoutException exception) { // Wallet.complete() method is called which is the case for all BSQ txs. We will work on a fix for that but that // will take more time. In the meantime we reduce the timeout to 5 seconds to avoid that the trade protocol runs // into a timeout when using BSQ for trade fee. + // For trade fee txs we set only 1 sec timeout for now. + // FIXME private static final int DEFAULT_BROADCAST_TIMEOUT = 5; - private static Map broadcastTimerMap = new HashMap<>(); + private static final Map broadcastTimerMap = new HashMap<>(); public static void broadcastTx(Wallet wallet, PeerGroup peerGroup, Transaction localTx, Callback callback) { broadcastTx(wallet, peerGroup, localTx, callback, DEFAULT_BROADCAST_TIMEOUT); } - public static void broadcastTx(Wallet wallet, PeerGroup peerGroup, Transaction tx, Callback callback, int delayInSec) { + public static void broadcastTx(Wallet wallet, PeerGroup peerGroup, Transaction tx, Callback callback, int timeOut) { Timer timeoutTimer; final String txId = tx.getHashAsString(); if (!broadcastTimerMap.containsKey(txId)) { timeoutTimer = UserThread.runAfter(() -> { - log.warn("Broadcast of tx {} not completed after {} sec.", txId, delayInSec); + log.warn("Broadcast of tx {} not completed after {} sec.", txId, timeOut); stopAndRemoveTimer(txId); - UserThread.execute(() -> callback.onTimeout(new TxBroadcastTimeoutException(tx, delayInSec, wallet))); - }, delayInSec); + UserThread.execute(() -> callback.onTimeout(new TxBroadcastTimeoutException(tx, timeOut, wallet))); + }, timeOut); broadcastTimerMap.put(txId, timeoutTimer); } else { 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 d56b34a7c95..25247ce7863 100644 --- a/core/src/main/java/bisq/core/btc/wallet/WalletService.java +++ b/core/src/main/java/bisq/core/btc/wallet/WalletService.java @@ -330,11 +330,14 @@ public static void signTransactionInput(Wallet wallet, // Broadcast tx /////////////////////////////////////////////////////////////////////////////////////////// - public void broadcastTx(Transaction tx, TxBroadcaster.Callback callback) { TxBroadcaster.broadcastTx(wallet, walletsSetup.getPeerGroup(), tx, callback); } + public void broadcastTx(Transaction tx, TxBroadcaster.Callback callback, int timeOut) { + TxBroadcaster.broadcastTx(wallet, walletsSetup.getPeerGroup(), tx, callback, timeOut); + } + /////////////////////////////////////////////////////////////////////////////////////////// // TransactionConfidence diff --git a/core/src/main/java/bisq/core/btc/wallet/WalletsManager.java b/core/src/main/java/bisq/core/btc/wallet/WalletsManager.java index af0d3aae9d2..c2cae2dd19e 100644 --- a/core/src/main/java/bisq/core/btc/wallet/WalletsManager.java +++ b/core/src/main/java/bisq/core/btc/wallet/WalletsManager.java @@ -154,9 +154,11 @@ public void publishAndCommitBsqTx(Transaction tx, TxType txType, TxBroadcaster.C // We need to create another instance, otherwise the tx would trigger an invalid state exception // if it gets committed 2 times // We clone before commit to avoid unwanted side effects - final Transaction clonedTx = btcWalletService.getClonedTransaction(tx); + Transaction clonedTx = btcWalletService.getClonedTransaction(tx); btcWalletService.commitTx(clonedTx); bsqWalletService.commitTx(tx, txType); - bsqWalletService.broadcastTx(tx, callback); + + // We use a short timeout as there are issues with BSQ txs. See comment in TxBroadcaster + bsqWalletService.broadcastTx(tx, callback, 1); } } diff --git a/core/src/main/java/bisq/core/offer/placeoffer/tasks/CreateMakerFeeTx.java b/core/src/main/java/bisq/core/offer/placeoffer/tasks/CreateMakerFeeTx.java index b7619ace86b..ec3792cb1f0 100644 --- a/core/src/main/java/bisq/core/offer/placeoffer/tasks/CreateMakerFeeTx.java +++ b/core/src/main/java/bisq/core/offer/placeoffer/tasks/CreateMakerFeeTx.java @@ -109,7 +109,7 @@ public void onFailure(TxBroadcastException exception) { } }); } else { - final BsqWalletService bsqWalletService = model.getBsqWalletService(); + BsqWalletService bsqWalletService = model.getBsqWalletService(); Transaction preparedBurnFeeTx = model.getBsqWalletService().getPreparedTradeFeeTx(offer.getMakerFee()); Transaction txWithBsqFee = tradeWalletService.completeBsqTradingFeeTx(preparedBurnFeeTx, fundingAddress, @@ -126,32 +126,34 @@ public void onFailure(TxBroadcastException exception) { // if it gets committed 2 times tradeWalletService.commitTx(tradeWalletService.getClonedTransaction(signedTx)); + // We use a short timeout as there are issues with BSQ txs. See comment in TxBroadcaster bsqWalletService.broadcastTx(signedTx, new TxBroadcaster.Callback() { - @Override - public void onSuccess(@Nullable Transaction transaction) { - if (transaction != null) { - offer.setOfferFeePaymentTxId(transaction.getHashAsString()); - model.setTransaction(transaction); - log.debug("onSuccess, offerId={}, OFFER_FUNDING", id); - walletService.swapTradeEntryToAvailableEntry(id, AddressEntry.Context.OFFER_FUNDING); - - log.debug("Successfully sent tx with id " + transaction.getHashAsString()); - model.getOffer().setState(Offer.State.OFFER_FEE_PAID); - - complete(); - } - } - - @Override - public void onFailure(TxBroadcastException exception) { - log.error(exception.toString()); - exception.printStackTrace(); - offer.setErrorMessage("An error occurred.\n" + - "Error message:\n" - + exception.getMessage()); - failed(exception); - } - }); + @Override + public void onSuccess(@Nullable Transaction transaction) { + if (transaction != null) { + offer.setOfferFeePaymentTxId(transaction.getHashAsString()); + model.setTransaction(transaction); + log.debug("onSuccess, offerId={}, OFFER_FUNDING", id); + walletService.swapTradeEntryToAvailableEntry(id, AddressEntry.Context.OFFER_FUNDING); + + log.debug("Successfully sent tx with id " + transaction.getHashAsString()); + model.getOffer().setState(Offer.State.OFFER_FEE_PAID); + + complete(); + } + } + + @Override + public void onFailure(TxBroadcastException exception) { + log.error(exception.toString()); + exception.printStackTrace(); + offer.setErrorMessage("An error occurred.\n" + + "Error message:\n" + + exception.getMessage()); + failed(exception); + } + }, + 1); } } catch (Throwable t) { if (t instanceof DaoDisabledException) { diff --git a/core/src/main/java/bisq/core/trade/protocol/tasks/taker/TakerPublishFeeTx.java b/core/src/main/java/bisq/core/trade/protocol/tasks/taker/TakerPublishFeeTx.java index 1a2090cac47..cdb035a636c 100644 --- a/core/src/main/java/bisq/core/trade/protocol/tasks/taker/TakerPublishFeeTx.java +++ b/core/src/main/java/bisq/core/trade/protocol/tasks/taker/TakerPublishFeeTx.java @@ -74,6 +74,7 @@ public void onFailure(TxBroadcastException exception) { // if it gets committed 2 times tradeWalletService.commitTx(tradeWalletService.getClonedTransaction(takeOfferFeeTx)); + // We use a short timeout as there are issues with BSQ txs. See comment in TxBroadcaster bsqWalletService.broadcastTx(takeOfferFeeTx, new TxBroadcaster.Callback() { @Override @@ -104,7 +105,8 @@ public void onFailure(TxBroadcastException exception) { log.warn("We got the onFailure callback called after the timeout has been triggered a complete()."); } } - }); + }, + 1); } } catch (Throwable t) { failed(t); From 352e661bacd24603fcaf1f74964040add25e0e41 Mon Sep 17 00:00:00 2001 From: chimp1984 Date: Sun, 13 Sep 2020 15:35:39 -0500 Subject: [PATCH 8/8] update devmode price --- .../java/bisq/desktop/main/offer/MutableOfferViewModel.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/desktop/src/main/java/bisq/desktop/main/offer/MutableOfferViewModel.java b/desktop/src/main/java/bisq/desktop/main/offer/MutableOfferViewModel.java index 989d063b25e..588c06cb564 100644 --- a/desktop/src/main/java/bisq/desktop/main/offer/MutableOfferViewModel.java +++ b/desktop/src/main/java/bisq/desktop/main/offer/MutableOfferViewModel.java @@ -231,7 +231,7 @@ public void activate() { if (DevEnv.isDevMode()) { UserThread.runAfter(() -> { amount.set("0.001"); - price.set("0.008"); + price.set("70000"); minAmount.set(amount.get()); onFocusOutPriceAsPercentageTextField(true, false); applyMakerFee();