Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 32 additions & 5 deletions packages/indexer-common/src/indexer-management/monitor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import {
resolveChainAlias,
TransferredSubgraphDeployment,
sequentialTimerReduce,
IndexingStatus,
} from '@graphprotocol/indexer-common'
import {
Address,
Expand Down Expand Up @@ -956,16 +957,42 @@ Please submit an issue at https://github.com/graphprotocol/block-oracle/issues/n
switch (poi == generatedPOI) {
case true:
if (poi == undefined) {
const deploymentStatus = await this.graphNode.indexingStatus([
allocation.subgraphDeployment.id,
])
const deploymentStatuses: IndexingStatus[] =
await this.graphNode.indexingStatus([allocation.subgraphDeployment.id])

const thisDeploymentStatus = deploymentStatuses.find(
(status) =>
status.subgraphDeployment.ipfsHash ==
allocation.subgraphDeployment.id.ipfsHash,
)
if (thisDeploymentStatus) {
const chain = thisDeploymentStatus.chains.find(
(chain) => chain.network == supportedNetworkAlias,
)
if (
chain &&
chain.latestBlock &&
chain.chainHeadBlock &&
chain.latestBlock.number <= chain.chainHeadBlock.number
) {
const generatedPOI = await this.graphNode.proofOfIndexing(
allocation.subgraphDeployment.id,
chain.latestBlock,
allocation.indexer,
)
if (generatedPOI !== undefined) {
return generatedPOI
}
}
}

throw indexerError(
IndexerErrorCode.IE067,
`POI not available for deployment at current epoch start block.
currentEpochStartBlock: ${epochStartBlock.number}
deploymentStatus: ${
deploymentStatus.length > 0
? JSON.stringify(deploymentStatus)
deploymentStatuses.length > 0
? JSON.stringify(deploymentStatuses)
: 'not deployed'
}`,
)
Expand Down
Loading