mx-api-service icon indicating copy to clipboard operation
mx-api-service copied to clipboard

node sync progress percentage

Open cfaur09 opened this issue 3 years ago • 0 comments

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

cfaur09 avatar Nov 15 '22 14:11 cfaur09