show daemon sync progress on startup then sync wallet

This commit is contained in:
woodser 2023-11-24 13:33:55 -05:00
parent 846b278b5d
commit d094997666
17 changed files with 119 additions and 86 deletions

View file

@ -31,6 +31,7 @@ import haveno.core.trade.Trade;
import haveno.core.trade.TradeManager;
import haveno.core.trade.protocol.TradeProtocol;
import haveno.core.trade.protocol.TradeProtocol.MailboxMessageComparator;
import haveno.core.xmr.wallet.XmrWalletService;
import haveno.network.p2p.AckMessage;
import haveno.network.p2p.AckMessageSourceType;
import haveno.network.p2p.DecryptedMessageWithPubKey;
@ -53,6 +54,7 @@ public abstract class SupportManager {
protected final P2PService p2PService;
protected final TradeManager tradeManager;
protected final CoreMoneroConnectionsService connectionService;
protected final XmrWalletService xmrWalletService;
protected final CoreNotificationService notificationService;
protected final Map<String, Timer> delayMsgMap = new HashMap<>();
private final Object lock = new Object();
@ -68,10 +70,12 @@ public abstract class SupportManager {
public SupportManager(P2PService p2PService,
CoreMoneroConnectionsService connectionService,
XmrWalletService xmrWalletService,
CoreNotificationService notificationService,
TradeManager tradeManager) {
this.p2PService = p2PService;
this.connectionService = connectionService;
this.xmrWalletService = xmrWalletService;
this.mailboxMessageService = p2PService.getMailboxMessageService();
this.notificationService = notificationService;
this.tradeManager = tradeManager;
@ -333,7 +337,8 @@ public abstract class SupportManager {
return allServicesInitialized &&
p2PService.isBootstrapped() &&
connectionService.isDownloadComplete() &&
connectionService.hasSufficientPeersForBroadcast();
connectionService.hasSufficientPeersForBroadcast() &&
xmrWalletService.isWalletSynced();
}

View file

@ -114,7 +114,7 @@ public abstract class DisputeManager<T extends DisputeList<Dispute>> extends Sup
DisputeListService<T> disputeListService,
Config config,
PriceFeedService priceFeedService) {
super(p2PService, connectionService, notificationService, tradeManager);
super(p2PService, connectionService, xmrWalletService, notificationService, tradeManager);
this.tradeWalletService = tradeWalletService;
this.xmrWalletService = xmrWalletService;
@ -257,6 +257,11 @@ public abstract class DisputeManager<T extends DisputeList<Dispute>> extends Sup
tryApplyMessages();
});
xmrWalletService.downloadPercentageProperty().addListener((observable, oldValue, newValue) -> {
if (xmrWalletService.isWalletSynced())
tryApplyMessages();
});
connectionService.numPeersProperty().addListener((observable, oldValue, newValue) -> {
if (connectionService.hasSufficientPeersForBroadcast())
tryApplyMessages();

View file

@ -28,6 +28,7 @@ import haveno.core.support.messages.ChatMessage;
import haveno.core.support.messages.SupportMessage;
import haveno.core.trade.Trade;
import haveno.core.trade.TradeManager;
import haveno.core.xmr.wallet.XmrWalletService;
import haveno.network.p2p.AckMessageSourceType;
import haveno.network.p2p.NodeAddress;
import haveno.network.p2p.P2PService;
@ -53,10 +54,11 @@ public class TraderChatManager extends SupportManager {
@Inject
public TraderChatManager(P2PService p2PService,
CoreMoneroConnectionsService connectionService,
XmrWalletService xmrWalletService,
CoreNotificationService notificationService,
TradeManager tradeManager,
PubKeyRingProvider pubKeyRingProvider) {
super(p2PService, connectionService, notificationService, tradeManager);
super(p2PService, connectionService, xmrWalletService, notificationService, tradeManager);
this.pubKeyRingProvider = pubKeyRingProvider;
}