Skip to content
Merged
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
27 changes: 14 additions & 13 deletions src/components/Indexer/crawlerThread.ts
Original file line number Diff line number Diff line change
Expand Up @@ -98,20 +98,21 @@ export async function processNetworkData(
): Promise<void> {
stoppedCrawling = startedCrawling = false
let contractDeploymentBlock = getDeployedContractBlock(rpcDetails.chainId)
if (!isDefined(contractDeploymentBlock) && !isDefined(await getLastIndexedBlock())) {
if (rpcDetails.chainId === DEVELOPMENT_CHAIN_ID) {
rpcDetails.startBlock = contractDeploymentBlock = 0
INDEXER_LOGGER.warn(
'Cannot get block info for local network, starting from block 0'
)
} else {
INDEXER_LOGGER.logMessage(
`chain: ${rpcDetails.chainId} Both deployed block and last indexed block are null/undefined. Cannot proceed further on this chain`,
true
)
const isLocalChain = rpcDetails.chainId === DEVELOPMENT_CHAIN_ID
if (isLocalChain && !isDefined(contractDeploymentBlock)) {
rpcDetails.startBlock = contractDeploymentBlock = 0
INDEXER_LOGGER.warn('Cannot get block info for local network, starting from block 0')
} else if (
!isLocalChain &&
!isDefined(contractDeploymentBlock) &&
!isDefined(await getLastIndexedBlock())
) {
INDEXER_LOGGER.logMessage(
`chain: ${rpcDetails.chainId} Both deployed block and last indexed block are null/undefined. Cannot proceed further on this chain`,
true
)

return null
}
return null
}
// if we defined a valid startBlock use it, oterwise start from deployed one

Expand Down
Loading