From e7349be3e50199de9bfa657df21252f5f44336c3 Mon Sep 17 00:00:00 2001 From: Etan Kissling Date: Sat, 22 Jun 2024 10:19:35 +0200 Subject: [PATCH] put correct sync committee branch version into DB --- beacon_chain/beacon_chain_db_light_client.nim | 3 +-- .../consensus_object_pools/blockchain_dag_light_client.nim | 6 ++++-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/beacon_chain/beacon_chain_db_light_client.nim b/beacon_chain/beacon_chain_db_light_client.nim index 2a47f7736..3ba23b022 100644 --- a/beacon_chain/beacon_chain_db_light_client.nim +++ b/beacon_chain/beacon_chain_db_light_client.nim @@ -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))) diff --git a/beacon_chain/consensus_object_pools/blockchain_dag_light_client.nim b/beacon_chain/consensus_object_pools/blockchain_dag_light_client.nim index da8b154f9..55eebd44b 100644 --- a/beacon_chain/consensus_object_pools/blockchain_dag_light_client.nim +++ b/beacon_chain/consensus_object_pools/blockchain_dag_light_client.nim @@ -723,9 +723,11 @@ proc createLightClientBootstrap( const lcDataFork = lcDataForkAtConsensusFork(consensusFork) dag.lcDataStore.db.putHeader( forkyBlck.toLightClientHeader(lcDataFork)) + dag.lcDataStore.db.putCurrentSyncCommitteeBranch( + bid.slot, normalize_merkle_branch( + dag.getLightClientData(bid).current_sync_committee_branch, + lcDataFork.CURRENT_SYNC_COMMITTEE_GINDEX)) else: raiseAssert "Unreachable" - dag.lcDataStore.db.putCurrentSyncCommitteeBranch( - bid.slot, dag.getLightClientData(bid).current_sync_committee_branch) ok() proc initLightClientDataCache*(dag: ChainDAGRef) =