Skip to content

Commit

Permalink
Merge pull request #6336
Browse files Browse the repository at this point in the history
760ecf2 console_handler: do not let exception past the dor (moneromooo-monero)
09c8111 threadpool: lock mutex in create (moneromooo-monero)
e377977 tx_pool: catch theoretical error in get_block_reward (moneromooo-monero)
  • Loading branch information
luigi1111 committed Mar 31, 2020
2 parents 94f44d4 + e377977 commit 6c7d928
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 4 deletions.
10 changes: 7 additions & 3 deletions contrib/epee/include/console_handler.h
Expand Up @@ -606,11 +606,15 @@ namespace epee
async_console_handler m_console_handler;
public:
~console_handlers_binder() {
stop_handling();
if (m_console_thread.get() != nullptr)
try
{
m_console_thread->join();
stop_handling();
if (m_console_thread.get() != nullptr)
{
m_console_thread->join();
}
}
catch (const std::exception &e) { /* ignore */ }
}

bool start_handling(std::function<std::string(void)> prompt, const std::string& usage_string = "", std::function<void(void)> exit_handler = NULL)
Expand Down
1 change: 1 addition & 0 deletions src/common/threadpool.cpp
Expand Up @@ -71,6 +71,7 @@ void threadpool::recycle() {
}

void threadpool::create(unsigned int max_threads) {
const boost::unique_lock<boost::mutex> lock(mutex);
boost::thread::attributes attrs;
attrs.set_stack_size(THREAD_STACK_SIZE);
max = max_threads ? max_threads : tools::get_max_concurrency();
Expand Down
6 changes: 5 additions & 1 deletion src/cryptonote_core/tx_pool.cpp
Expand Up @@ -1283,7 +1283,11 @@ namespace cryptonote
fee = 0;

//baseline empty block
get_block_reward(median_weight, total_weight, already_generated_coins, best_coinbase, version);
if (!get_block_reward(median_weight, total_weight, already_generated_coins, best_coinbase, version))
{
MERROR("Failed to get block reward for empty block");
return false;
}


size_t max_total_weight_pre_v5 = (130 * median_weight) / 100 - CRYPTONOTE_COINBASE_BLOB_RESERVED_SIZE;
Expand Down

0 comments on commit 6c7d928

Please sign in to comment.