tx_pool: fix infinite loop when failing to find a meta record

This commit is contained in:
moneromooo-monero 2018-08-17 17:24:24 +00:00 committed by wowario
parent d4f07b40de
commit 7e6b4601c3
No known key found for this signature in database
GPG Key ID: 24DCBE762DE9C111
1 changed files with 1 additions and 7 deletions

View File

@ -1095,7 +1095,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))
@ -1109,7 +1109,6 @@ namespace cryptonote
if (max_total_size < total_size + meta.blob_size)
{
LOG_PRINT_L2(" would exceed maximum block size");
sorted_it++;
continue;
}
@ -1122,14 +1121,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;
}
}
@ -1173,13 +1170,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;
}
@ -1188,7 +1183,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));
}