From b939eaf7b1689f15de2cb070ecb2c67fbec6187f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tom=C3=A1=C5=A1=20Zemanovi=C4=8D?= Date: Wed, 7 Aug 2024 13:19:01 +0100 Subject: [PATCH 1/2] parameters/max_block_time: fallback to parameters only when no blocks --- crates/parameters/src/lib.rs | 15 +++------------ 1 file changed, 3 insertions(+), 12 deletions(-) diff --git a/crates/parameters/src/lib.rs b/crates/parameters/src/lib.rs index 55a91c75d5..9ef3591b95 100644 --- a/crates/parameters/src/lib.rs +++ b/crates/parameters/src/lib.rs @@ -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)] From 4f584ded9847437e0c88fb85040a5a705cbbfe45 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tom=C3=A1=C5=A1=20Zemanovi=C4=8D?= Date: Wed, 7 Aug 2024 13:27:12 +0100 Subject: [PATCH 2/2] changelog: add #3591 --- .../unreleased/improvements/3591-max-block-time-estimate.md | 2 ++ 1 file changed, 2 insertions(+) create mode 100644 .changelog/unreleased/improvements/3591-max-block-time-estimate.md diff --git a/.changelog/unreleased/improvements/3591-max-block-time-estimate.md b/.changelog/unreleased/improvements/3591-max-block-time-estimate.md new file mode 100644 index 0000000000..fed62890a2 --- /dev/null +++ b/.changelog/unreleased/improvements/3591-max-block-time-estimate.md @@ -0,0 +1,2 @@ +- Improved the `max_block_time` estimate. + ([\#3591](https://github.com/anoma/namada/pull/3591)) \ No newline at end of file