Skip to content

Keep chain tip in memory for sync_chain_mmr endpoint #1841

@sergerad

Description

@sergerad

Not for this PR, but it may be good to keep this info in memory somehow so that we could avoid going to the DB just to look up just to figure out which block number to use. Maybe this could be returned from State::latest_block_num() - e.g., as something like:

let chain_tip = self.state.latest_block_num(finality_level).await;

Let's create an issue for this.

Originally posted by @bobbinth in #1725 (comment)

        // Determine the effective tip based on the requested finality level.
        let effective_tip = match request.finality() {
            proto::rpc::Finality::Unspecified | proto::rpc::Finality::Committed => chain_tip,
            proto::rpc::Finality::Proven => self
                .state
                .db()
                .select_latest_proven_block_num()
                .await
                .map_err(SyncChainMmrError::DatabaseError)?,
        };

Metadata

Metadata

Assignees

Labels

storeRelated to the store component

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions