maximum block size 130% of median

This commit is contained in:
mydesktop 2014-05-26 19:51:22 -04:00
parent 31a59785b0
commit f545fd8ff0

View file

@ -357,13 +357,18 @@ namespace cryptonote
size_t max_total_size = 2 * median_size - CRYPTONOTE_COINBASE_BLOB_RESERVED_SIZE; // Max block size size_t max_total_size = 2 * median_size - CRYPTONOTE_COINBASE_BLOB_RESERVED_SIZE; // Max block size
std::unordered_set<crypto::key_image> k_images; std::unordered_set<crypto::key_image> k_images;
// Tx size limit as in wallet2.h
uint64_t upper_transaction_size_limit = ((CRYPTONOTE_BLOCK_GRANTED_FULL_REWARD_ZONE * 125) / 100) - CRYPTONOTE_COINBASE_BLOB_RESERVED_SIZE;
BOOST_FOREACH(transactions_container::value_type& tx, m_transactions) BOOST_FOREACH(transactions_container::value_type& tx, m_transactions)
{ {
// Can not exceed maximum block size // Can not exceed maximum block size
if (max_total_size < total_size + tx.second.blob_size) if (max_total_size < total_size + tx.second.blob_size)
continue; continue;
// Check to see if the minimum fee is included // Check to see if the minimum fee is included;
// exclude tx missing minimum fee
if (tx.second.fee < DEFAULT_FEE) if (tx.second.fee < DEFAULT_FEE)
continue; continue;
@ -372,14 +377,20 @@ namespace cryptonote
// such that it is based on median block size; // such that it is based on median block size;
// We need to make a similar patch for // We need to make a similar patch for
// wallet2.h // wallet2.h
uint64_t upper_transaction_size_limit = ((CRYPTONOTE_BLOCK_GRANTED_FULL_REWARD_ZONE * 125) / 100) - CRYPTONOTE_COINBASE_BLOB_RESERVED_SIZE;
if (tx.second.blob_size > upper_transaction_size_limit) if (tx.second.blob_size > upper_transaction_size_limit)
continue; continue;
// If adding this tx will make the block size
// greater than 130% of the median, reject the
// tx; this will keep down largely punitive tx
// from being included
if ( (total_size + tx.second.blob_size) > ((130 * median_size) / 100) )
continue;
// If we've exceeded the penalty free size, // If we've exceeded the penalty free size,
// stop including more tx // stop including more tx
if (total_size > median_size) if (total_size > median_size)
continue; break;
// 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