Merge pull request #1752

c3283093 tx_pool: revert template filling changes (moneromooo-monero)
This commit is contained in:
Riccardo Spagni 2017-02-21 00:48:14 +02:00
commit fb9e4e15ed
No known key found for this signature in database
GPG Key ID: 55432DF31CCD4FCD

View File

@ -619,7 +619,11 @@ namespace cryptonote
get_block_reward(median_size, total_size, already_generated_coins, best_coinbase, version); get_block_reward(median_size, total_size, already_generated_coins, best_coinbase, version);
#if 1
size_t max_total_size = (130 * median_size) / 100 - CRYPTONOTE_COINBASE_BLOB_RESERVED_SIZE;
#else
size_t max_total_size = 2 * median_size - CRYPTONOTE_COINBASE_BLOB_RESERVED_SIZE; size_t max_total_size = 2 * median_size - CRYPTONOTE_COINBASE_BLOB_RESERVED_SIZE;
#endif
std::unordered_set<crypto::key_image> k_images; std::unordered_set<crypto::key_image> k_images;
LOG_PRINT_L2("Filling block template, median size " << median_size << ", " << m_txs_by_fee_and_receive_time.size() << " txes in the pool"); LOG_PRINT_L2("Filling block template, median size " << median_size << ", " << m_txs_by_fee_and_receive_time.size() << " txes in the pool");
@ -637,6 +641,15 @@ namespace cryptonote
continue; continue;
} }
#if 1
// If we've exceeded the penalty free size,
// stop including more tx
if (total_size > median_size)
{
LOG_PRINT_L2(" would exceed median block size");
break;
}
#else
// If we're getting lower coinbase tx, // If we're getting lower coinbase tx,
// stop including more tx // stop including more tx
uint64_t block_reward; uint64_t block_reward;
@ -653,6 +666,7 @@ namespace cryptonote
sorted_it++; sorted_it++;
continue; continue;
} }
#endif
// Skip transactions that are not ready to be // Skip transactions that are not ready to be
// included into the blockchain or that are // included into the blockchain or that are
@ -667,7 +681,9 @@ namespace cryptonote
bl.tx_hashes.push_back(tx_it->first); bl.tx_hashes.push_back(tx_it->first);
total_size += tx_it->second.blob_size; total_size += tx_it->second.blob_size;
fee += tx_it->second.fee; fee += tx_it->second.fee;
#if 0
best_coinbase = coinbase; best_coinbase = coinbase;
#endif
append_key_images(k_images, tx_it->second.tx); append_key_images(k_images, tx_it->second.tx);
sorted_it++; sorted_it++;
LOG_PRINT_L2(" added, new block size " << total_size << "/" << max_total_size << ", coinbase " << print_money(best_coinbase)); LOG_PRINT_L2(" added, new block size " << total_size << "/" << max_total_size << ", coinbase " << print_money(best_coinbase));