aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--contrib/epee/include/console_handler.h10
-rw-r--r--src/common/threadpool.cpp1
-rw-r--r--src/cryptonote_core/tx_pool.cpp6
3 files changed, 13 insertions, 4 deletions
diff --git a/contrib/epee/include/console_handler.h b/contrib/epee/include/console_handler.h
index 1b716fca4..a7788aeb8 100644
--- a/contrib/epee/include/console_handler.h
+++ b/contrib/epee/include/console_handler.h
@@ -606,11 +606,15 @@ eof:
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)
diff --git a/src/common/threadpool.cpp b/src/common/threadpool.cpp
index 18204eeee..753bf238c 100644
--- a/src/common/threadpool.cpp
+++ b/src/common/threadpool.cpp
@@ -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();
diff --git a/src/cryptonote_core/tx_pool.cpp b/src/cryptonote_core/tx_pool.cpp
index 05cbf14a8..53a6ce579 100644
--- a/src/cryptonote_core/tx_pool.cpp
+++ b/src/cryptonote_core/tx_pool.cpp
@@ -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;