Skip to content

Commit

Permalink
Merge pull request #3591 from anoma/tomas/max-block-time-estimate
Browse files Browse the repository at this point in the history
parameters/max_block_time: fallback to parameters only when no blocks
  • Loading branch information
mergify[bot] committed Aug 8, 2024
2 parents 7b052e5 + 4f584de commit 26e628a
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 12 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
- Improved the `max_block_time` estimate.
([\#3591](https://github.com/anoma/namada/pull/3591))
15 changes: 3 additions & 12 deletions crates/parameters/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -622,18 +622,9 @@ where
last_block_height,
num_blocks_to_read,
)?;
let max_block_time_estimate =
estimate_max_block_time_from_parameters(storage)?;

Ok(maybe_max_block_time.map_or(
max_block_time_estimate,
|max_block_time_over_num_blocks_to_read| {
std::cmp::max(
max_block_time_over_num_blocks_to_read,
max_block_time_estimate,
)
},
))

maybe_max_block_time
.map_or_else(|| estimate_max_block_time_from_parameters(storage), Ok)
}

#[cfg(test)]
Expand Down

0 comments on commit 26e628a

Please sign in to comment.