@@ -31,6 +31,7 @@ public abstract class XmrWalletBase {
31
31
public static final int SYNC_PROGRESS_TIMEOUT_SECONDS = 120 ;
32
32
public static final int DIRECT_SYNC_WITHIN_BLOCKS = 100 ;
33
33
public static final int SAVE_WALLET_DELAY_SECONDS = 300 ;
34
+ private static final String SYNC_PROGRESS_TIMEOUT_MSG = "Sync progress timeout called" ;
34
35
35
36
// inherited
36
37
protected MoneroWallet wallet ;
@@ -114,12 +115,6 @@ public void onSyncProgress(long height, long startHeight, long endHeight, double
114
115
log .warn ("Error getting wallet height while syncing with progress: " + e .getMessage ());
115
116
log .warn (ExceptionUtils .getStackTrace (e ));
116
117
}
117
-
118
- // stop polling and release latch
119
- syncProgressLooper .stop ();
120
- syncProgressTimeout .stop ();
121
- syncProgressError = e ;
122
- syncProgressLatch .countDown ();
123
118
return ;
124
119
}
125
120
long appliedTargetHeight = repeatSyncToLatestHeight ? xmrConnectionService .getTargetHeight () : targetHeightAtStart ;
@@ -168,6 +163,10 @@ public void saveWalletWithDelay() {
168
163
169
164
// --------------------------------- ABSTRACT -----------------------------
170
165
166
+ public static boolean isSyncWithProgressTimeout (Throwable e ) {
167
+ return e .getMessage ().equals (SYNC_PROGRESS_TIMEOUT_MSG );
168
+ }
169
+
171
170
public abstract void saveWallet ();
172
171
173
172
public abstract void requestSaveWallet ();
@@ -201,7 +200,7 @@ private synchronized void resetSyncProgressTimeout() {
201
200
if (syncProgressTimeout != null ) syncProgressTimeout .stop ();
202
201
syncProgressTimeout = UserThread .runAfter (() -> {
203
202
if (isShutDownStarted ) return ;
204
- syncProgressError = new RuntimeException ("Sync progress timeout called" );
203
+ syncProgressError = new RuntimeException (SYNC_PROGRESS_TIMEOUT_MSG );
205
204
syncProgressLatch .countDown ();
206
205
}, SYNC_PROGRESS_TIMEOUT_SECONDS , TimeUnit .SECONDS );
207
206
}
0 commit comments