Skip to content

Commit

Permalink
Merge pull request #4276
Browse files Browse the repository at this point in the history
48a7bc4 tx_pool: fix infinite loop when failing to find a meta record (moneromooo-monero)
  • Loading branch information
luigi1111 committed Sep 4, 2018
2 parents 0722287 + 48a7bc4 commit 03738fd
Showing 1 changed file with 1 addition and 7 deletions.
8 changes: 1 addition & 7 deletions src/cryptonote_core/tx_pool.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1154,7 +1154,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))
Expand All @@ -1168,7 +1168,6 @@ namespace cryptonote
if (max_total_size < total_size + meta.blob_size)
{
LOG_PRINT_L2(" would exceed maximum block size");
sorted_it++;
continue;
}

Expand All @@ -1181,14 +1180,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;
}
}
Expand Down Expand Up @@ -1235,13 +1232,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;
}

Expand All @@ -1250,7 +1245,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));
}

Expand Down

0 comments on commit 03738fd

Please sign in to comment.