mirror of
https://github.com/haveno-dex/haveno.git
synced 2025-01-10 21:04:35 +00:00
sync main wallet outside lock on connection changed
This commit is contained in:
parent
bc4d8fc8c2
commit
e160499d30
1 changed files with 10 additions and 8 deletions
|
@ -300,6 +300,10 @@ public class XmrWalletService {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private MoneroSyncResult syncWallet() {
|
||||||
|
return syncWallet(wallet);
|
||||||
|
}
|
||||||
|
|
||||||
public void saveWallet(MoneroWallet wallet, boolean backup) {
|
public void saveWallet(MoneroWallet wallet, boolean backup) {
|
||||||
wallet.save();
|
wallet.save();
|
||||||
if (backup) backupWallet(wallet.getPath());
|
if (backup) backupWallet(wallet.getPath());
|
||||||
|
@ -791,7 +795,7 @@ public class XmrWalletService {
|
||||||
if (wallet.getHeight() < xmrConnectionService.getTargetHeight()) updateSyncProgress();
|
if (wallet.getHeight() < xmrConnectionService.getTargetHeight()) updateSyncProgress();
|
||||||
else {
|
else {
|
||||||
syncLooper.stop();
|
syncLooper.stop();
|
||||||
wallet.sync(); // necessary to fully sync
|
syncWallet(); // necessary to fully sync
|
||||||
wasWalletSynced = true;
|
wasWalletSynced = true;
|
||||||
updateSyncProgress();
|
updateSyncProgress();
|
||||||
latch.countDown();
|
latch.countDown();
|
||||||
|
@ -940,14 +944,12 @@ 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(() -> {
|
||||||
synchronized (walletLock) {
|
|
||||||
try {
|
try {
|
||||||
if (Boolean.TRUE.equals(connection.isConnected())) wallet.sync();
|
if (Boolean.TRUE.equals(connection.isConnected())) syncWallet();
|
||||||
wallet.startSyncing(xmrConnectionService.getRefreshPeriodMs());
|
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());
|
||||||
}
|
}
|
||||||
}
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue