Skip to content
This repository has been archived by the owner on Jun 11, 2024. It is now read-only.

Implement syncBlocks function of LegacyChainHandler #7486

Closed
Tracked by #7136
ishantiw opened this issue Sep 6, 2022 · 1 comment
Closed
Tracked by #7136

Implement syncBlocks function of LegacyChainHandler #7486

ishantiw opened this issue Sep 6, 2022 · 1 comment
Assignees
Milestone

Comments

@ishantiw
Copy link
Contributor

ishantiw commented Sep 6, 2022

Description

Implement syncBlocks function of LegacyChainHandler

  1. Get a list of connectedPeers from the network
  2. Find peers with legacy info corresponding to snapshotBlockID (if it contains legacy property with the snapshotBlockID as requested then it means it has the legacy blocks history)
  3. If no peer is found then throw PeerNotFound error
  4. Randomly select a peer from the filtered peers list (something like Math.trunc(Math.random() * filteredPeers.length - 1))
  5. Request the peer with getLegacyBlocksFromId RPC and receive response with request param { id: Buffer }
    4.1. if response is invalid or validateLegacyBlock(blockBytes, nextBlock) fails then ban the peer with 100 penalty by calling network.applyPenalty(peerID, banScore)
  6. Save the blocks and repeat step 1 to 4 until we reach startHeight defined in the config.
  7. Once we reach the startHeight of a bracket we save the bracketInfo and return setLegacyChainBracketInfo(bracketInfo)

Acceptance Criteria

  • Should have all the cases covered with the unit tests

Addtional Information

@sitetester
Copy link
Contributor

Depends on #7498

@sitetester sitetester self-assigned this Sep 16, 2022
@milenagojkovic milenagojkovic moved this from Backlog to ToDo in Lisk SDK Version 6.0.0 Sep 19, 2022
@milenagojkovic milenagojkovic moved this from ToDo to In Progress in Lisk SDK Version 6.0.0 Sep 20, 2022
@ishantiw ishantiw changed the title Implement sync function of LegacyChainHandler Implement syncBlocks function of LegacyChainHandler Sep 22, 2022
@shuse2 shuse2 modified the milestones: Sprint 78, Sprint 79 Sep 26, 2022
@shuse2 shuse2 modified the milestones: Sprint 79, Sprint 80 Oct 10, 2022
ishantiw added a commit that referenced this issue Oct 21, 2022
…LegacyChainHandler

Implement sync function of legacy chain handler - Closes  #7547 & #7486
Repository owner moved this from In Progress to Done in Lisk SDK Version 6.0.0 Oct 21, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants