mirror of
https://codeberg.org/anoncontributorxmr/monero.git
synced 2024-11-30 14:53:27 +01:00
Merge pull request #1902
7c033498
blockchain: lower the relay fee by 2% (moneromooo-monero)266492e9
tx_pool: use new filling algorithm from v5 only (moneromooo-monero)5b7c6ced
wallet2: start using new fee priorities at v5, not 14 days laer (moneromooo-monero)
This commit is contained in:
commit
37eebd9dcf
@ -2860,7 +2860,7 @@ bool Blockchain::check_fee(size_t blob_size, uint64_t fee) const
|
|||||||
needed_fee += (blob_size % 1024) ? 1 : 0;
|
needed_fee += (blob_size % 1024) ? 1 : 0;
|
||||||
needed_fee *= fee_per_kb;
|
needed_fee *= fee_per_kb;
|
||||||
|
|
||||||
if (fee < needed_fee)
|
if (fee < needed_fee * 0.98) // keep a little buffer on acceptance
|
||||||
{
|
{
|
||||||
MERROR_VER("transaction fee is not enough: " << print_money(fee) << ", minimum fee: " << print_money(needed_fee));
|
MERROR_VER("transaction fee is not enough: " << print_money(fee) << ", minimum fee: " << print_money(needed_fee));
|
||||||
return false;
|
return false;
|
||||||
|
@ -614,7 +614,7 @@ namespace cryptonote
|
|||||||
|
|
||||||
CRITICAL_REGION_LOCAL(m_transactions_lock);
|
CRITICAL_REGION_LOCAL(m_transactions_lock);
|
||||||
|
|
||||||
uint64_t best_coinbase = 0;
|
uint64_t best_coinbase = 0, coinbase;
|
||||||
total_size = 0;
|
total_size = 0;
|
||||||
fee = 0;
|
fee = 0;
|
||||||
|
|
||||||
@ -622,11 +622,9 @@ 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_pre_v5 = (130 * median_size) / 100 - CRYPTONOTE_COINBASE_BLOB_RESERVED_SIZE;
|
||||||
size_t max_total_size = (130 * median_size) / 100 - CRYPTONOTE_COINBASE_BLOB_RESERVED_SIZE;
|
size_t max_total_size_v5 = 2 * median_size - CRYPTONOTE_COINBASE_BLOB_RESERVED_SIZE;
|
||||||
#else
|
size_t max_total_size = version >= 5 ? max_total_size_v5 : max_total_size_pre_v5;
|
||||||
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");
|
||||||
@ -644,6 +642,9 @@ namespace cryptonote
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// start using the optimal filling algorithm from v5
|
||||||
|
if (version >= 5)
|
||||||
|
{
|
||||||
// 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,13 +654,24 @@ namespace cryptonote
|
|||||||
sorted_it++;
|
sorted_it++;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
uint64_t coinbase = block_reward + fee + tx_it->second.fee;
|
coinbase = block_reward + fee + tx_it->second.fee;
|
||||||
if (coinbase < template_accept_threshold(best_coinbase))
|
if (coinbase < template_accept_threshold(best_coinbase))
|
||||||
{
|
{
|
||||||
LOG_PRINT_L2(" would decrease coinbase to " << print_money(coinbase));
|
LOG_PRINT_L2(" would decrease coinbase to " << print_money(coinbase));
|
||||||
sorted_it++;
|
sorted_it++;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// 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;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// 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
|
||||||
@ -680,9 +692,7 @@ 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));
|
||||||
|
@ -3379,7 +3379,7 @@ uint64_t wallet2::get_per_kb_fee()
|
|||||||
int wallet2::get_fee_algorithm()
|
int wallet2::get_fee_algorithm()
|
||||||
{
|
{
|
||||||
// changes at v3 and v5
|
// changes at v3 and v5
|
||||||
if (use_fork_rules(5, -720 * 14))
|
if (use_fork_rules(5, 0))
|
||||||
return 2;
|
return 2;
|
||||||
if (use_fork_rules(3, -720 * 14))
|
if (use_fork_rules(3, -720 * 14))
|
||||||
return 1;
|
return 1;
|
||||||
|
Loading…
Reference in New Issue
Block a user