diff options
author | Riccardo Spagni <ric@spagni.net> | 2016-12-04 22:23:03 +0200 |
---|---|---|
committer | Riccardo Spagni <ric@spagni.net> | 2016-12-04 22:23:03 +0200 |
commit | 416f7fbd5f9f8218f72a73a090c4689163c3c2b6 (patch) | |
tree | 2582e3778c68d5b8744a39f88fdfd61a11628834 /src/cryptonote_core/blockchain.cpp | |
parent | Merge pull request #1389 (diff) | |
parent | blockchain: use high bound block reward on error where appropriate (diff) | |
download | monero-416f7fbd5f9f8218f72a73a090c4689163c3c2b6.tar.xz |
Merge pull request #1392
204b1bff blockchain: use high bound block reward on error where appropriate (moneromooo-monero)
Diffstat (limited to 'src/cryptonote_core/blockchain.cpp')
-rw-r--r-- | src/cryptonote_core/blockchain.cpp | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/src/cryptonote_core/blockchain.cpp b/src/cryptonote_core/blockchain.cpp index bf2b4b71a..64694fe81 100644 --- a/src/cryptonote_core/blockchain.cpp +++ b/src/cryptonote_core/blockchain.cpp @@ -73,6 +73,9 @@ extern "C" void slow_hash_free_state(); DISABLE_VS_WARNINGS(4267) +// used to overestimate the block reward when estimating a per kB to use +#define BLOCK_REWARD_OVERESTIMATE (10 * 1000000000000) + static const struct { uint8_t version; uint64_t height; @@ -2796,7 +2799,10 @@ uint64_t Blockchain::get_dynamic_per_kb_fee_estimate(uint64_t grace_blocks) cons uint64_t already_generated_coins = m_db->height() ? m_db->get_block_already_generated_coins(m_db->height() - 1) : 0; uint64_t base_reward; if (!get_block_reward(median, 1, already_generated_coins, base_reward, version)) - return false; + { + LOG_PRINT_L1("Failed to determine block reward, using placeholder " << print_money(BLOCK_REWARD_OVERESTIMATE) << " as a high bound"); + base_reward = BLOCK_REWARD_OVERESTIMATE; + } uint64_t fee = get_dynamic_per_kb_fee(base_reward, median); LOG_PRINT_L2("Estimating " << grace_blocks << "-block fee at " << print_money(fee) << "/kB"); |