mirror of
https://git.wownero.com/wownero/wownero.git
synced 2024-08-15 01:03:23 +00:00
temporary fix for block reward dos
This commit is contained in:
parent
e717125073
commit
31a59785b0
3 changed files with 31 additions and 3 deletions
|
@ -7,7 +7,8 @@ Release notes 0.8.8
|
||||||
- Fixed a bug with checkpoints behavior
|
- Fixed a bug with checkpoints behavior
|
||||||
- UI improvements for daemon
|
- UI improvements for daemon
|
||||||
- Fixed COIN value (10^12)
|
- Fixed COIN value (10^12)
|
||||||
- Raised minimum fee to (1/2) * (10^10)
|
- Raised minimum fee to 5 * (10^9)
|
||||||
|
- Temporary fix for block reward DoS attack
|
||||||
|
|
||||||
Release notes 0.8.7
|
Release notes 0.8.7
|
||||||
|
|
||||||
|
|
|
@ -355,13 +355,35 @@ namespace cryptonote
|
||||||
total_size = 0;
|
total_size = 0;
|
||||||
fee = 0;
|
fee = 0;
|
||||||
|
|
||||||
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; // Max block size
|
||||||
std::unordered_set<crypto::key_image> k_images;
|
std::unordered_set<crypto::key_image> k_images;
|
||||||
BOOST_FOREACH(transactions_container::value_type& tx, m_transactions)
|
BOOST_FOREACH(transactions_container::value_type& tx, m_transactions)
|
||||||
{
|
{
|
||||||
|
// 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
|
||||||
|
if (tx.second.fee < DEFAULT_FEE)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
// Skip transactions that are too large
|
||||||
|
// TODO: Correct upper_transactions_size_limit
|
||||||
|
// such that it is based on median block size;
|
||||||
|
// We need to make a similar patch for
|
||||||
|
// 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)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
// If we've exceeded the penalty free size,
|
||||||
|
// stop including more tx
|
||||||
|
if (total_size > median_size)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
// Skip transactions that are not ready to be
|
||||||
|
// included into the blockchain or that are
|
||||||
|
// missing key images
|
||||||
if (!is_transaction_ready_to_go(tx.second) || have_key_images(k_images, tx.second.tx))
|
if (!is_transaction_ready_to_go(tx.second) || have_key_images(k_images, tx.second.tx))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
|
|
@ -102,7 +102,12 @@ namespace tools
|
||||||
void store();
|
void store();
|
||||||
cryptonote::account_base& get_account(){return m_account;}
|
cryptonote::account_base& get_account(){return m_account;}
|
||||||
|
|
||||||
void init(const std::string& daemon_address = "http://localhost:8080", uint64_t upper_transaction_size_limit = CRYPTONOTE_BLOCK_GRANTED_FULL_REWARD_ZONE*2 - CRYPTONOTE_COINBASE_BLOB_RESERVED_SIZE);
|
// upper_transaction_size_limit as defined below is set to
|
||||||
|
// approximately 125% of the fixed minimum allowable penalty
|
||||||
|
// free block size. TODO: fix this so that it actually takes
|
||||||
|
// into account the current median block size rather than
|
||||||
|
// the minimum block size.
|
||||||
|
void init(const std::string& daemon_address = "http://localhost:8080", uint64_t upper_transaction_size_limit = ((CRYPTONOTE_BLOCK_GRANTED_FULL_REWARD_ZONE * 125) / 100) - CRYPTONOTE_COINBASE_BLOB_RESERVED_SIZE);
|
||||||
bool deinit();
|
bool deinit();
|
||||||
|
|
||||||
void stop() { m_run.store(false, std::memory_order_relaxed); }
|
void stop() { m_run.store(false, std::memory_order_relaxed); }
|
||||||
|
|
Loading…
Reference in a new issue