From 0e5c7e5de798c72c974aecedc648172eb05e69ae Mon Sep 17 00:00:00 2001 From: jmacxx <47253594+jmacxx@users.noreply.github.com> Date: Mon, 22 Feb 2021 17:56:30 -0600 Subject: [PATCH 1/2] Fix initialization ordering issue TradeManager must be inited before MailboxMessageService --- .../main/java/bisq/core/app/DomainInitialisation.java | 2 +- p2p/src/main/java/bisq/network/p2p/P2PService.java | 9 ++++----- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/core/src/main/java/bisq/core/app/DomainInitialisation.java b/core/src/main/java/bisq/core/app/DomainInitialisation.java index 8bdc28c989d..a5aa26c236c 100644 --- a/core/src/main/java/bisq/core/app/DomainInitialisation.java +++ b/core/src/main/java/bisq/core/app/DomainInitialisation.java @@ -196,12 +196,12 @@ public void initDomainServices(Consumer rejectedTxErrorMessageHandler, tradeLimits.onAllServicesInitialized(); + tradeManager.onAllServicesInitialized(); arbitrationManager.onAllServicesInitialized(); mediationManager.onAllServicesInitialized(); refundManager.onAllServicesInitialized(); traderChatManager.onAllServicesInitialized(); - tradeManager.onAllServicesInitialized(); closedTradableManager.onAllServicesInitialized(); failedTradesManager.onAllServicesInitialized(); xmrTxProofService.onAllServicesInitialized(); diff --git a/p2p/src/main/java/bisq/network/p2p/P2PService.java b/p2p/src/main/java/bisq/network/p2p/P2PService.java index 0bac8ac70bf..6f363ddc31f 100644 --- a/p2p/src/main/java/bisq/network/p2p/P2PService.java +++ b/p2p/src/main/java/bisq/network/p2p/P2PService.java @@ -334,13 +334,12 @@ private void applyIsBootstrapped(Consumer listenerHandler) { p2PDataStorage.onBootstrapped(); - // We don't use a listener at mailboxMessageService as we require the correct - // order of execution. The p2pServiceListeners must be called after - // mailboxMessageService.onUpdatedDataReceived. - mailboxMessageService.onBootstrapped(); - // Once we have applied the state in the P2P domain we notify our listeners p2pServiceListeners.forEach(listenerHandler); + + // We don't use a listener at mailboxMessageService as we require the correct + // order of execution. The p2pServiceListeners must be called before. + mailboxMessageService.onBootstrapped(); } } From d3b62b1a588a81c62c0728c00d2ce8512a7ae22b Mon Sep 17 00:00:00 2001 From: jmacxx <47253594+jmacxx@users.noreply.github.com> Date: Tue, 23 Feb 2021 21:12:59 -0600 Subject: [PATCH 2/2] TraderChatManager to handle onAllServicesInitialized Upon receipt of onAllServicesInitialized, TraderChatManager should call tryApplyMessages in order to process any pending mailbox messages stored up while offline. --- .../java/bisq/core/support/traderchat/TraderChatManager.java | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/core/src/main/java/bisq/core/support/traderchat/TraderChatManager.java b/core/src/main/java/bisq/core/support/traderchat/TraderChatManager.java index 4c0406f429b..a2dc887ad9e 100644 --- a/core/src/main/java/bisq/core/support/traderchat/TraderChatManager.java +++ b/core/src/main/java/bisq/core/support/traderchat/TraderChatManager.java @@ -139,6 +139,11 @@ protected AckMessageSourceType getAckMessageSourceType() { // API /////////////////////////////////////////////////////////////////////////////////////////// + public void onAllServicesInitialized() { + super.onAllServicesInitialized(); + tryApplyMessages(); + } + public void onSupportMessage(SupportMessage message) { if (canProcessMessage(message)) { log.info("Received {} with tradeId {} and uid {}",