put correct sync committee branch version into DB

This commit is contained in:
Etan Kissling 2024-06-22 10:19:35 +02:00
parent c0d07e1b24
commit e7349be3e5
No known key found for this signature in database
GPG Key ID: B21DA824C5A3D03D
2 changed files with 5 additions and 4 deletions

View File

@ -329,8 +329,7 @@ proc getCurrentSyncCommitteeBranch*[T: ForkyCurrentSyncCommitteeBranch](
func putCurrentSyncCommitteeBranch*[T: ForkyCurrentSyncCommitteeBranch](
db: LightClientDataDB, slot: Slot, branch: T) =
doAssert not db.backend.readOnly # All `stmt` are non-nil
if not slot.isSupportedBySQLite or
distinctBase(db.currentBranches[T.kind].getStmt) == nil:
if not slot.isSupportedBySQLite:
return
let res = db.currentBranches[T.kind].putStmt.exec(
(slot.int64, SSZ.encode(branch)))

View File

@ -723,9 +723,11 @@ proc createLightClientBootstrap(
const lcDataFork = lcDataForkAtConsensusFork(consensusFork)
dag.lcDataStore.db.putHeader(
forkyBlck.toLightClientHeader(lcDataFork))
else: raiseAssert "Unreachable"
dag.lcDataStore.db.putCurrentSyncCommitteeBranch(
bid.slot, dag.getLightClientData(bid).current_sync_committee_branch)
bid.slot, normalize_merkle_branch(
dag.getLightClientData(bid).current_sync_committee_branch,
lcDataFork.CURRENT_SYNC_COMMITTEE_GINDEX))
else: raiseAssert "Unreachable"
ok()
proc initLightClientDataCache*(dag: ChainDAGRef) =