aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorluigi1111 <luigi1111w@gmail.com>2022-10-28 00:46:19 -0400
committerluigi1111 <luigi1111w@gmail.com>2022-10-28 00:46:19 -0400
commit45ffdc26a6fd2e674c1b038d8abfe0e131195fb9 (patch)
treef7e5e5cbf92f2ede52a10f2556f6fe5ac57fac0b
parentMerge pull request #8516 (diff)
parentblockchain: fix invalid memory read getting fee on empty chain (diff)
downloadmonero-45ffdc26a6fd2e674c1b038d8abfe0e131195fb9.tar.xz
Merge pull request #8517
6f0fb76 blockchain: fix invalid memory read getting fee on empty chain (Crypto City)
-rw-r--r--src/cryptonote_core/blockchain.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/cryptonote_core/blockchain.cpp b/src/cryptonote_core/blockchain.cpp
index 657db311b..135dd3df0 100644
--- a/src/cryptonote_core/blockchain.cpp
+++ b/src/cryptonote_core/blockchain.cpp
@@ -3868,7 +3868,7 @@ void Blockchain::get_dynamic_base_fee_estimate_2021_scaling(uint64_t grace_block
epee::misc_utils::rolling_median_t<uint64_t> rm = m_long_term_block_weights_cache_rolling_median;
for (size_t i = 0; i < grace_blocks; ++i)
rm.insert(0);
- const uint64_t Mlw_penalty_free_zone_for_wallet = std::max<uint64_t>(rm.median(), CRYPTONOTE_BLOCK_GRANTED_FULL_REWARD_ZONE_V5);
+ const uint64_t Mlw_penalty_free_zone_for_wallet = std::max<uint64_t>(rm.size() == 0 ? 0 : rm.median(), CRYPTONOTE_BLOCK_GRANTED_FULL_REWARD_ZONE_V5);
// Msw: median over [100 - grace blocks] past + [grace blocks] future blocks
CHECK_AND_ASSERT_THROW_MES(grace_blocks <= 100, "Grace blocks invalid In 2021 fee scaling estimate.");