File tree Expand file tree Collapse file tree 2 files changed +18
-1
lines changed
Expand file tree Collapse file tree 2 files changed +18
-1
lines changed Original file line number Diff line number Diff line change @@ -23,6 +23,12 @@ export const getNodeAvailability = async (
2323 const currentEpoch : number = getCurrentEpoch ( config ) ;
2424 const firstCheckEpoch : number = getLicenseFirstCheckEpoch ( config , assignTimestamp ) ;
2525
26+ if ( currentEpoch - firstCheckEpoch <= 1 ) {
27+ console . log ( 'getNodeLastEpoch' ) ;
28+ } else {
29+ console . log ( 'getNodeEpochsRange' , firstCheckEpoch , currentEpoch - 1 ) ;
30+ }
31+
2632 // If the license was linked in the current or previous epoch
2733 return currentEpoch - firstCheckEpoch <= 1
2834 ? await getNodeLastEpoch ( nodeEthAddr )
Original file line number Diff line number Diff line change @@ -287,8 +287,19 @@ const calculateLicenseRewards = async (
287287 return 0n ;
288288 }
289289
290+ // Disregard epochs before the cliff epoch for MNDs
291+ if ( cliffEpochs > 0 && epochs [ 0 ] < cliffEpochs ) {
292+ const start = cliffEpochs - epochs [ 0 ] ;
293+ epochs = epochs . slice ( start ) ;
294+ epochs_vals = epochs_vals . slice ( start ) ;
295+ }
296+
290297 if ( epochsToClaim !== epochs . length || epochsToClaim !== epochs_vals . length ) {
291- throw new Error ( 'Invalid epochs array length.' ) ;
298+ console . error (
299+ `Invalid epochs array length. Received ${ epochs . length } epochs, but there are ${ epochsToClaim } epochs to claim.` ,
300+ ) ;
301+
302+ return 0n ;
292303 }
293304
294305 const maxRewardsPerEpoch = license . totalAssignedAmount / BigInt ( vestingEpochs ) ;
You can’t perform that action at this time.
0 commit comments