sync wallet on open

This commit is contained in:
woodser 2022-07-29 12:04:47 -04:00
parent a5f457d8e9
commit 608c19a1d0

View File

@ -445,7 +445,7 @@ public class XmrWalletService {
if (sync) { if (sync) {
log.info("Syncing wallet " + config.getPath() + " in background"); log.info("Syncing wallet " + config.getPath() + " in background");
walletRpc.startSyncing(connectionsService.getDefaultRefreshPeriodMs()); walletRpc.startSyncing(connectionsService.getDefaultRefreshPeriodMs());
log.info("Done starting background wallet sync for " + config.getPath()); log.info("Done starting background sync for wallet " + config.getPath());
} else { } else {
walletRpc.setDaemonConnection(daemonConnection); walletRpc.setDaemonConnection(daemonConnection);
} }
@ -469,10 +469,17 @@ public class XmrWalletService {
log.info("Opening wallet " + config.getPath()); log.info("Opening wallet " + config.getPath());
walletRpc.openWallet(config); walletRpc.openWallet(config);
// start syncing wallet in background // sync wallet
log.info("Syncing wallet " + config.getPath() + " in background"); log.info("Syncing wallet " + config.getPath());
walletRpc.startSyncing(connectionsService.getDefaultRefreshPeriodMs()); walletRpc.sync();
log.info("Done syncing wallet " + config.getPath()); log.info("Done syncing wallet " + config.getPath());
// start syncing wallet in background
new Thread(() -> {
log.info("Syncing wallet " + config.getPath() + " in background");
walletRpc.startSyncing(connectionsService.getDefaultRefreshPeriodMs());
log.info("Done starting background sync for wallet " + config.getPath());
}).start();
return walletRpc; return walletRpc;
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();