Skip to content

Commit 2893288

Browse files
committed
fix: pattern matching for api call
1 parent edfc1ff commit 2893288

File tree

1 file changed

+5
-9
lines changed

1 file changed

+5
-9
lines changed

crates/services/gas_price_service/src/v1/da_source_adapter/block_committer_costs.rs

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -77,17 +77,13 @@ where
7777
BlockCommitter: BlockCommitterApi,
7878
{
7979
async fn request_da_block_cost(&mut self) -> DaBlockCostsResult<DaBlockCosts> {
80-
let raw_da_block_costs;
81-
82-
if let Some(last_value) = &self.last_raw_da_block_costs {
83-
raw_da_block_costs = self
80+
let raw_da_block_costs = match self.last_raw_da_block_costs {
81+
Some(ref last_value) => self
8482
.client
85-
.get_costs_by_seqno(last_value.sequence_number + 1)
86-
.await?;
87-
} else {
88-
// we have to error if we cannot find the first set of costs
89-
raw_da_block_costs = self.client.get_latest_costs().await?;
83+
.get_costs_by_seqno(last_value.sequence_number + 1),
84+
_ => self.client.get_latest_costs(),
9085
}
86+
.await?;
9187

9288
let Some(ref raw_da_block_costs) = raw_da_block_costs else {
9389
return Err(anyhow!("No response from block committer"))

0 commit comments

Comments
 (0)