mx-api-service
mx-api-service copied to clipboard
node sync progress percentage
Description of the reasoning behind the pull request (what feature was missing / how the problem was manifesting itself / what was the motive behind the refactoring)
- This is mocked implementation of node syncProgress
Requirement:
on the gateway /network/trie-statistics/[shard_id] should return erd_accounts_snapshot_num_nodes which should represent “100%” of node syncing progress
on the heartbeatstatus, if the numTrieNodesReceived > 0, then we set a syncProgress as number of trie nodes received / total number of nodes (a value between 0 and 1). if nodes received = 0, then the syncProgress value will be absent`
Proposed Changes
- Mock /network/trie-statistics/[shard_id] gateway and node/heartbeatstatus endpoints and create based on requirement the node syncProgress
Formula: numOfNodeSync / accounts_snapshot_num_nodes * 100
How to test
- remove .skip from getSyncProgress tests
- run test nodes.e2e-spec.ts