@@ -184,13 +184,13 @@ export class Agent {
184
184
}
185
185
186
186
reconciliationLoop ( ) {
187
+ const { network, operator } = this . networkAndOperator
187
188
const requestIntervalSmall = this . pollingInterval
188
189
const requestIntervalLarge = this . pollingInterval * 5
189
190
const logger = this . logger . child ( { component : 'ReconciliationLoop' } )
190
191
const currentEpochNumber : Eventual < number > = sequentialTimerMap (
191
192
{ logger, milliseconds : requestIntervalLarge } ,
192
193
async ( ) => {
193
- const { network } = this . networkAndOperator
194
194
logger . trace ( 'Fetching current epoch number' , {
195
195
protocolNetwork : network . specification . networkIdentifier ,
196
196
} )
@@ -202,8 +202,6 @@ export class Agent {
202
202
} ,
203
203
)
204
204
205
- const { network } = this . networkAndOperator
206
-
207
205
const maxAllocationEpochs : Eventual < number > = sequentialTimerMap (
208
206
{ logger, milliseconds : requestIntervalLarge } ,
209
207
async ( ) => {
@@ -222,7 +220,6 @@ export class Agent {
222
220
sequentialTimerMap (
223
221
{ logger, milliseconds : requestIntervalSmall } ,
224
222
async ( ) => {
225
- const { network, operator } = this . networkAndOperator
226
223
logger . trace ( 'Fetching indexing rules' , {
227
224
protocolNetwork : network . specification . networkIdentifier ,
228
225
} )
@@ -260,7 +257,6 @@ export class Agent {
260
257
sequentialTimerMap (
261
258
{ logger, milliseconds : requestIntervalLarge } ,
262
259
async ( ) => {
263
- const { network } = this . networkAndOperator
264
260
if (
265
261
this . deploymentManagement === DeploymentManagementMode . AUTO ||
266
262
network . networkMonitor . poiDisputeMonitoringEnabled ( )
@@ -290,7 +286,6 @@ export class Agent {
290
286
sequentialTimerMap (
291
287
{ logger, milliseconds : requestIntervalSmall } ,
292
288
async ( ) => {
293
- const { network } = this . networkAndOperator
294
289
logger . trace ( 'Fetching network deployments' , {
295
290
protocolNetwork : network . specification . networkIdentifier ,
296
291
} )
@@ -367,7 +362,6 @@ export class Agent {
367
362
const activeAllocations : Eventual < Allocation [ ] > = sequentialTimerMap (
368
363
{ logger, milliseconds : requestIntervalSmall } ,
369
364
async ( ) => {
370
- const { network } = this . networkAndOperator
371
365
logger . trace ( 'Fetching active allocations' , {
372
366
protocolNetwork : network . specification . networkIdentifier ,
373
367
} )
@@ -389,13 +383,12 @@ export class Agent {
389
383
} ) . tryMap (
390
384
// eslint-disable-next-line @typescript-eslint/no-unused-vars
391
385
async ( { activeAllocations : _ , currentEpochNumber } ) => {
392
- const { network } = this . networkAndOperator
393
- const allocationsByNetwork =
386
+ const recentlyClosedAllocations =
394
387
await network . networkMonitor . recentlyClosedAllocations (
395
388
currentEpochNumber ,
396
389
1 ,
397
390
)
398
- return Object . values ( allocationsByNetwork ) . flat ( )
391
+ return Object . values ( recentlyClosedAllocations ) . flat ( )
399
392
} ,
400
393
{
401
394
onError : ( ) =>
@@ -410,7 +403,6 @@ export class Agent {
410
403
activeDeployments,
411
404
} ) . tryMap (
412
405
async ( { currentEpochNumber, activeDeployments } ) => {
413
- const { network } = this . networkAndOperator
414
406
logger . trace ( 'Fetching disputable allocations' , {
415
407
protocolNetwork : network . specification . networkIdentifier ,
416
408
currentEpochNumber,
@@ -455,7 +447,6 @@ export class Agent {
455
447
} )
456
448
457
449
try {
458
- const { network, operator } = this . networkAndOperator
459
450
const disputableEpochs =
460
451
currentEpochNumber -
461
452
network . specification . indexerOptions . poiDisputableEpochs
@@ -918,7 +909,7 @@ export class Agent {
918
909
// Network Subgraph is NEVER allocated towards
919
910
// --------------------------------------------------------------------------------
920
911
const { network, operator } = this . networkAndOperator
921
- let validatedAllocationDecisions = allocationDecisions
912
+ let validatedAllocationDecisions = [ ... allocationDecisions ]
922
913
923
914
if (
924
915
network . specification . indexerOptions . allocationManagementMode ===
@@ -940,12 +931,12 @@ export class Agent {
940
931
networkSubgraphDeployment &&
941
932
! network . specification . indexerOptions . allocateOnNetworkSubgraph
942
933
) {
943
- const networkSubgraphIndex = allocationDecisions . findIndex (
934
+ const networkSubgraphIndex = validatedAllocationDecisions . findIndex (
944
935
decision =>
945
936
decision . deployment . bytes32 == networkSubgraphDeployment . id . bytes32 ,
946
937
)
947
938
if ( networkSubgraphIndex >= 0 ) {
948
- allocationDecisions [ networkSubgraphIndex ] . toAllocate = false
939
+ validatedAllocationDecisions [ networkSubgraphIndex ] . toAllocate = false
949
940
}
950
941
}
951
942
}
0 commit comments