@@ -212,12 +212,15 @@ const watch = async () => {
212
212
213
213
const veaEpochOutboxClaimableNowOld = veaEpochOutboxClaimableNow ;
214
214
veaEpochOutboxClaimableNow = Math . floor ( timeGnosis / epochPeriod ) - 1 ;
215
- // TODO: sometimes veaEpochOutboxClaimableNow is 1 epoch behind veaEpochOutboxClaimableNowOld
216
- const veaEpochsOutboxClaimableNew : number [ ] = new Array ( veaEpochOutboxClaimableNow - veaEpochOutboxClaimableNowOld )
217
- . fill ( veaEpochOutboxClaimableNowOld + 1 )
218
- . map ( ( el , i ) => el + i ) ;
219
215
220
- veaEpochOutboxCheckClaimsRangeArray . concat ( veaEpochsOutboxClaimableNew ) ;
216
+ if ( veaEpochOutboxClaimableNow > veaEpochOutboxClaimableNowOld ) {
217
+ const veaEpochsOutboxClaimableNew : number [ ] = new Array (
218
+ veaEpochOutboxClaimableNow - veaEpochOutboxClaimableNowOld
219
+ )
220
+ . fill ( veaEpochOutboxClaimableNowOld + 1 )
221
+ . map ( ( el , i ) => el + i ) ;
222
+ veaEpochOutboxCheckClaimsRangeArray . push ( ...veaEpochsOutboxClaimableNew ) ;
223
+ }
221
224
222
225
if ( veaEpochOutboxCheckClaimsRangeArray . length == 0 ) {
223
226
console . log ( "no claims to check" ) ;
@@ -248,7 +251,7 @@ const watch = async () => {
248
251
) ;
249
252
veaEpochOutboxCheckClaimsRangeArray . splice ( index , 1 ) ;
250
253
index -- ;
251
- if ( challenges . has ( index ) ) challenges . delete ( index ) ;
254
+ if ( challenges . has ( veaEpochOutboxCheck ) ) challenges . delete ( veaEpochOutboxCheck ) ;
252
255
continue ;
253
256
} else {
254
257
console . log (
@@ -320,7 +323,7 @@ const watch = async () => {
320
323
continue ;
321
324
}
322
325
console . log ( veaEpochOutboxCheck , "claim found " , { claim } ) ;
323
- const previousProgress = challenges . get ( index ) || ( { } as any ) ;
326
+ const previousProgress = challenges . get ( veaEpochOutboxCheck ) || ( { } as any ) ;
324
327
let challengeProgress = await reconstructChallengeProgress (
325
328
veaEpochOutboxCheck ,
326
329
veaOutbox ,
@@ -333,7 +336,7 @@ const watch = async () => {
333
336
amb ,
334
337
previousProgress
335
338
) ;
336
- challenges . set ( index , challengeProgress ) ;
339
+ challenges . set ( veaEpochOutboxCheck , challengeProgress ) ;
337
340
console . log (
338
341
"challenge progess for epoch " + veaEpochOutboxCheck + " is " + JSON . stringify ( challengeProgress )
339
342
) ;
@@ -389,7 +392,7 @@ const watch = async () => {
389
392
finalized : false ,
390
393
} ;
391
394
challengeProgress . status = "WithdrawalPending" ;
392
- challenges . set ( index , challengeProgress ) ;
395
+ challenges . set ( veaEpochOutboxCheck , challengeProgress ) ;
393
396
}
394
397
}
395
398
}
0 commit comments