diff --git a/core/src/stores/data_cache.rs b/core/src/stores/data_cache.rs index ffb49ecc..9270a1d4 100644 --- a/core/src/stores/data_cache.rs +++ b/core/src/stores/data_cache.rs @@ -65,8 +65,7 @@ impl DataCache { > sent_transaction_info.last_valid_block_height } - pub async fn get_current_epoch(&self) -> Epoch { - let commitment = CommitmentConfig::confirmed(); + pub async fn get_current_epoch(&self, commitment: CommitmentConfig) -> Epoch { let BlockInformation { slot, .. } = self .block_information_store .get_latest_block(commitment) diff --git a/lite-rpc/src/bridge.rs b/lite-rpc/src/bridge.rs index 61abe442..4508fc8e 100644 --- a/lite-rpc/src/bridge.rs +++ b/lite-rpc/src/bridge.rs @@ -338,18 +338,21 @@ impl LiteRpcServer for LiteBridge { async fn get_epoch_info( &self, - _config: Option, + config: Option, ) -> crate::rpc::Result { + let commitment_config = config + .map(|config| config.commitment.unwrap_or_default()) + .unwrap_or_default(); let block_info = self .data_cache .block_information_store - .get_latest_block_info(CommitmentConfig::finalized()) + .get_latest_block_info(commitment_config) .await; //TODO manage transaction_count of epoch info. Currently None. let epoch_info = self .data_cache - .get_current_epoch() + .get_current_epoch(commitment_config) .await .into_epoch_info(block_info.block_height, None); Ok(epoch_info)