You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Jun 11, 2024. It is now read-only.
Implement syncBlocks function of LegacyChainHandler
Get a list of connectedPeers from the network
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)
If no peer is found then throw PeerNotFound error
Randomly select a peer from the filtered peers list (something like Math.trunc(Math.random() * filteredPeers.length - 1))
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)
Save the blocks and repeat step 1 to 4 until we reach startHeight defined in the config.
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
Description
Implement
syncBlocks
function ofLegacyChainHandler
snapshotBlockID
(if it containslegacy
property with thesnapshotBlockID
as requested then it means it has the legacy blocks history)PeerNotFound
errorMath.trunc(Math.random() * filteredPeers.length - 1)
)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 callingnetwork.applyPenalty(peerID, banScore)
setLegacyChainBracketInfo(bracketInfo)
Acceptance Criteria
Addtional Information
PeerNotFound
error with argument as messageThe text was updated successfully, but these errors were encountered: