try syncing main wallet when height > target height on startup

This commit is contained in:
woodser 2024-01-01 21:06:33 -05:00
parent 0a3736bba0
commit 43bbb29384

View file

@ -841,7 +841,11 @@ public class XmrWalletService {
if (wallet.getHeight() < xmrConnectionService.getTargetHeight()) updateSyncProgress(); if (wallet.getHeight() < xmrConnectionService.getTargetHeight()) updateSyncProgress();
else { else {
syncLooper.stop(); syncLooper.stop();
syncWallet(); // necessary to fully sync try {
syncWallet(); // ensure finished syncing
} catch (Exception e) {
e.printStackTrace();
}
wasWalletSynced = true; wasWalletSynced = true;
updateSyncProgress(); updateSyncProgress();
latch.countDown(); latch.countDown();
@ -990,9 +994,10 @@ public class XmrWalletService {
if (connection != null) { if (connection != null) {
wallet.getDaemonConnection().setPrintStackTrace(PRINT_STACK_TRACE); wallet.getDaemonConnection().setPrintStackTrace(PRINT_STACK_TRACE);
HavenoUtils.submitToPool(() -> { HavenoUtils.submitToPool(() -> {
if (isShutDownStarted) return;
wallet.startSyncing(xmrConnectionService.getRefreshPeriodMs());
try { try {
if (Boolean.TRUE.equals(connection.isConnected())) syncWallet(); if (Boolean.TRUE.equals(connection.isConnected())) syncWallet();
wallet.startSyncing(xmrConnectionService.getRefreshPeriodMs());
} catch (Exception e) { } catch (Exception e) {
log.warn("Failed to sync main wallet after setting daemon connection: " + e.getMessage()); log.warn("Failed to sync main wallet after setting daemon connection: " + e.getMessage());
} }