Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

script to traverse thro' blocks to find incorrect block [with wrong parent hash] #8

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

KarishmaBothara
Copy link
Contributor

@KarishmaBothara KarishmaBothara commented Jun 28, 2022

This way it scales well.. If we try to join the existing tables, it is very time consuming and doesn't scale well.
Added a new end point on uat which takes range of blocks and gets the detail
https://service.eks.centrality.cloud/cennznet-explorer-api/api/scan/blocksV2?start_block=11003&end_block=12002

Cannot use the existing endpoint for blocks as it gives different result as the size of the table increases as it use pagination logic. I have got one wrong block on uat (11954247)

});
}
}
lastInTheLoop = blockList[blockList.length-1];
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would call it lastInPrevLoop

});
}
}
for (let idx = 0; idx < blockList.length - 1; idx++) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

use blockList.forEach here might reads better than another for loop

console.log('blockWithIncorrectParentHash:',blockWithIncorrectParentHash);
}

fetchValidBlocks().catch((err) => console.log(err));
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

process.exit(1); in catch to terminate it?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants