use commitment config for RPC call
This commit is contained in:
parent
c6aba8f396
commit
178da3cc00
|
@ -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)
|
||||
|
|
|
@ -338,18 +338,21 @@ impl LiteRpcServer for LiteBridge {
|
|||
|
||||
async fn get_epoch_info(
|
||||
&self,
|
||||
_config: Option<RpcContextConfig>,
|
||||
config: Option<RpcContextConfig>,
|
||||
) -> crate::rpc::Result<EpochInfo> {
|
||||
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)
|
||||
|
|
Loading…
Reference in New Issue