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

Define storage for saving info about legacy chain brackets #7545

Closed
Tracked by #7136
ishantiw opened this issue Sep 21, 2022 · 0 comments · Fixed by #7581
Closed
Tracked by #7136

Define storage for saving info about legacy chain brackets #7545

ishantiw opened this issue Sep 21, 2022 · 0 comments · Fixed by #7581
Assignees
Milestone

Comments

@ishantiw
Copy link
Contributor

ishantiw commented Sep 21, 2022

Description

  • Create a new DB_KEY_LEGACY_BRACKETS for storing legacy chain brackets
  • Each bracket is identified by Buffer.concat([DB_KEY_LEGACY_BRACKETS, bracket.snapshotBlockID]) with value as
interface LegacyChainBracketInfo { 
  startHeight: number;
  snapshotBlockHeight: number;
  lastBlockHeight: number;
}
  • In LegacyChainHandler.init, if there is no key exists for a snapshotBlockID we initialize as below,

key:

config.bracket[index].snapshotBlockID

value:

{
  startHeight: config.bracket[index].startHeight,
  snapshotBlockHeight: config.bracket[index].snapshotBlockHeight,
  lastBlockHeight:  config.bracket[index].snapshotBlockHeight
}
  • Implement getLegacyChainBracketInfo(snapshotBlockID): Promise<LegacyChainBracket>
  • Implement setLegacyChainBracketInfo(snapshotBlockID: Buffer, bracketInfo: LegacyChainBracket): Promise<void>

Acceptance Criteria

  • Should have unit test corresponding to it
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants