mirror of
https://github.com/boldsuck/haveno.git
synced 2024-12-22 20:19:21 +00:00
reinitialize main wallet on same thread as connection change
This commit is contained in:
parent
cb132e727a
commit
ebcadb7bed
1 changed files with 88 additions and 87 deletions
|
@ -1304,7 +1304,10 @@ public class XmrWalletService {
|
|||
}
|
||||
|
||||
private void maybeInitMainWallet(boolean sync, int numAttempts) {
|
||||
ThreadUtils.execute(() -> {
|
||||
ThreadUtils.execute(() -> doMaybeInitMainWallet(sync, numAttempts), THREAD_ID);
|
||||
}
|
||||
|
||||
private void doMaybeInitMainWallet(boolean sync, int numAttempts) {
|
||||
synchronized (WALLET_LOCK) {
|
||||
if (isShutDownStarted) return;
|
||||
|
||||
|
@ -1397,7 +1400,6 @@ public class XmrWalletService {
|
|||
startPolling();
|
||||
}
|
||||
}
|
||||
}, THREAD_ID);
|
||||
}
|
||||
|
||||
private void resetIfWalletChanged() {
|
||||
|
@ -1679,7 +1681,7 @@ public class XmrWalletService {
|
|||
} else {
|
||||
log.info("Restarting main wallet because proxy URI has changed, old={}, new={}", oldProxyUri, newProxyUri); // TODO: set proxy without restarting wallet
|
||||
closeMainWallet(true);
|
||||
maybeInitMainWallet(false);
|
||||
doMaybeInitMainWallet(false, MAX_SYNC_ATTEMPTS);
|
||||
return; // wallet is re-initialized
|
||||
}
|
||||
} else {
|
||||
|
@ -1846,7 +1848,6 @@ public class XmrWalletService {
|
|||
synchronized (HavenoUtils.getDaemonLock()) {
|
||||
try {
|
||||
cachedTxs = wallet.getTxs(new MoneroTxQuery().setIncludeOutputs(true));
|
||||
lastLogPollErrorTimestamp = null;
|
||||
} catch (Exception e) { // fetch from pool can fail
|
||||
if (!isShutDownStarted) {
|
||||
if (lastLogPollErrorTimestamp == null || System.currentTimeMillis() - lastLogPollErrorTimestamp > HavenoUtils.LOG_POLL_ERROR_PERIOD_MS) { // limit error logging
|
||||
|
|
Loading…
Reference in a new issue