aboutsummaryrefslogtreecommitdiff
path: root/src/cryptonote_core/tx_pool.cpp
diff options
context:
space:
mode:
authormoneromooo-monero <moneromooo-monero@users.noreply.github.com>2018-08-17 17:24:24 +0000
committermoneromooo-monero <moneromooo-monero@users.noreply.github.com>2018-08-19 17:47:05 +0000
commit48a7bc4280b7aef7c9ef1179c5a3f9027abb243a (patch)
tree0635016ce81a0b7c73795c396b4fa62f32e1d84e /src/cryptonote_core/tx_pool.cpp
parentMerge pull request #4191 (diff)
downloadmonero-48a7bc4280b7aef7c9ef1179c5a3f9027abb243a.tar.xz
tx_pool: fix infinite loop when failing to find a meta record
Diffstat (limited to 'src/cryptonote_core/tx_pool.cpp')
-rw-r--r--src/cryptonote_core/tx_pool.cpp8
1 files changed, 1 insertions, 7 deletions
diff --git a/src/cryptonote_core/tx_pool.cpp b/src/cryptonote_core/tx_pool.cpp
index eac0f1f57..3b8dd8107 100644
--- a/src/cryptonote_core/tx_pool.cpp
+++ b/src/cryptonote_core/tx_pool.cpp
@@ -1140,7 +1140,7 @@ namespace cryptonote
LockedTXN lock(m_blockchain);
auto sorted_it = m_txs_by_fee_and_receive_time.begin();
- while (sorted_it != m_txs_by_fee_and_receive_time.end())
+ for (; sorted_it != m_txs_by_fee_and_receive_time.end(); ++sorted_it)
{
txpool_tx_meta_t meta;
if (!m_blockchain.get_txpool_tx_meta(sorted_it->second, meta))
@@ -1154,7 +1154,6 @@ namespace cryptonote
if (max_total_size < total_size + meta.blob_size)
{
LOG_PRINT_L2(" would exceed maximum block size");
- sorted_it++;
continue;
}
@@ -1167,14 +1166,12 @@ namespace cryptonote
if(!get_block_reward(median_size, total_size + meta.blob_size, already_generated_coins, block_reward, version))
{
LOG_PRINT_L2(" would exceed maximum block size");
- sorted_it++;
continue;
}
coinbase = block_reward + fee + meta.fee;
if (coinbase < template_accept_threshold(best_coinbase))
{
LOG_PRINT_L2(" would decrease coinbase to " << print_money(coinbase));
- sorted_it++;
continue;
}
}
@@ -1221,13 +1218,11 @@ namespace cryptonote
if (!ready)
{
LOG_PRINT_L2(" not ready to go");
- sorted_it++;
continue;
}
if (have_key_images(k_images, tx))
{
LOG_PRINT_L2(" key images already seen");
- sorted_it++;
continue;
}
@@ -1236,7 +1231,6 @@ namespace cryptonote
fee += meta.fee;
best_coinbase = coinbase;
append_key_images(k_images, tx);
- sorted_it++;
LOG_PRINT_L2(" added, new block size " << total_size << "/" << max_total_size << ", coinbase " << print_money(best_coinbase));
}