mirror of
https://github.com/boldsuck/haveno.git
synced 2024-12-23 04:29:22 +00:00
do not update from pool on shared wallet sync
This commit is contained in:
parent
d0a25d7d5b
commit
e4b80ef14b
1 changed files with 4 additions and 10 deletions
|
@ -381,18 +381,12 @@ public class XmrWalletService {
|
||||||
Callable<MoneroSyncResult> task = () -> wallet.sync();
|
Callable<MoneroSyncResult> task = () -> wallet.sync();
|
||||||
Future<MoneroSyncResult> future = syncWalletThreadPool.submit(task);
|
Future<MoneroSyncResult> future = syncWalletThreadPool.submit(task);
|
||||||
try {
|
try {
|
||||||
MoneroSyncResult result = future.get();
|
return future.get();
|
||||||
wallet.getTxs(); // TODO: this is necessary to sync from pool, otherwise balance can be incorrect
|
|
||||||
return result;
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
throw new MoneroError(e.getMessage());
|
throw new MoneroError(e.getMessage());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private MoneroSyncResult syncWallet() {
|
|
||||||
return syncWallet(wallet);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void saveWallet(MoneroWallet wallet) {
|
public void saveWallet(MoneroWallet wallet) {
|
||||||
saveWallet(wallet, false);
|
saveWallet(wallet, false);
|
||||||
}
|
}
|
||||||
|
@ -1426,7 +1420,7 @@ public class XmrWalletService {
|
||||||
else {
|
else {
|
||||||
syncWithProgressLooper.stop();
|
syncWithProgressLooper.stop();
|
||||||
try {
|
try {
|
||||||
syncWallet(); // ensure finished syncing
|
doPollWallet(true);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
|
@ -1751,11 +1745,11 @@ public class XmrWalletService {
|
||||||
}
|
}
|
||||||
|
|
||||||
private void pollWallet() {
|
private void pollWallet() {
|
||||||
|
if (pollInProgress) return;
|
||||||
doPollWallet(true);
|
doPollWallet(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void doPollWallet(boolean updateTxs) {
|
private void doPollWallet(boolean updateTxs) {
|
||||||
if (pollInProgress) return;
|
|
||||||
synchronized (pollLock) {
|
synchronized (pollLock) {
|
||||||
pollInProgress = true;
|
pollInProgress = true;
|
||||||
try {
|
try {
|
||||||
|
@ -1775,7 +1769,7 @@ public class XmrWalletService {
|
||||||
if (wallet.getHeight() < xmrConnectionService.getTargetHeight()) wallet.sync();
|
if (wallet.getHeight() < xmrConnectionService.getTargetHeight()) wallet.sync();
|
||||||
|
|
||||||
// fetch transactions from pool and store to cache
|
// fetch transactions from pool and store to cache
|
||||||
// TODO: ideally wallet should sync every poll and then avoid updating from pool on fetching txs
|
// TODO: ideally wallet should sync every poll and then avoid updating from pool on fetching txs?
|
||||||
if (updateTxs) {
|
if (updateTxs) {
|
||||||
try {
|
try {
|
||||||
cachedTxs = wallet.getTxs(new MoneroTxQuery().setIncludeOutputs(true));
|
cachedTxs = wallet.getTxs(new MoneroTxQuery().setIncludeOutputs(true));
|
||||||
|
|
Loading…
Reference in a new issue