mirror of
https://github.com/bisq-network/bisq.git
synced 2024-11-19 18:03:12 +01:00
Move delay for applying mailbox messages inside onInitialized
We need to set addDecryptedDirectMessageListener without delay as otherwise we could miss direct messages (detected with localhost testing, with tor its likely slower and would not have been triggered).
This commit is contained in:
parent
d6f4eed39e
commit
a4db09fe1d
@ -71,22 +71,24 @@ public abstract class TradeProtocol implements DecryptedDirectMessageListener, D
|
||||
|
||||
public void initialize(ProcessModelServiceProvider serviceProvider, TradeManager tradeManager, Offer offer) {
|
||||
processModel.applyTransient(serviceProvider, tradeManager, offer);
|
||||
|
||||
// We delay a bit here as the trade gets updated from the wallet to update the trade
|
||||
// state (deposit confirmed) and that happens after our method is called.
|
||||
// TODO To fix that in a better way we would need to change the order of some routines
|
||||
// from the TradeManager, but as we are close to a release I dont want to risk a bigger
|
||||
// change and leave that for a later PR
|
||||
UserThread.runAfter(this::onInitialized, 100, TimeUnit.MILLISECONDS);
|
||||
onInitialized();
|
||||
}
|
||||
|
||||
protected void onInitialized() {
|
||||
if (!trade.isWithdrawn()) {
|
||||
processModel.getP2PService().addDecryptedDirectMessageListener(this);
|
||||
}
|
||||
processModel.getP2PService().addDecryptedMailboxListener(this);
|
||||
processModel.getP2PService().getMailBoxMessages()
|
||||
.forEach(this::handleDecryptedMessageWithPubKey);
|
||||
|
||||
// We delay a bit here as the trade gets updated from the wallet to update the trade
|
||||
// state (deposit confirmed) and that happens after our method is called.
|
||||
// TODO To fix that in a better way we would need to change the order of some routines
|
||||
// from the TradeManager, but as we are close to a release I dont want to risk a bigger
|
||||
// change and leave that for a later PR
|
||||
UserThread.runAfter(() -> {
|
||||
processModel.getP2PService().addDecryptedMailboxListener(this);
|
||||
processModel.getP2PService().getMailBoxMessages()
|
||||
.forEach(this::handleDecryptedMessageWithPubKey);
|
||||
}, 100, TimeUnit.MILLISECONDS);
|
||||
}
|
||||
|
||||
public void onWithdrawCompleted() {
|
||||
|
Loading…
Reference in New Issue
Block a user