Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix fee priority for block fill #1631

Merged
merged 3 commits into from
Feb 2, 2017
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 8 additions & 4 deletions src/cryptonote_core/tx_pool.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ namespace cryptonote
size_t const TRANSACTION_SIZE_LIMIT_V2 = (((CRYPTONOTE_BLOCK_GRANTED_FULL_REWARD_ZONE_V2 * 125) / 100) - CRYPTONOTE_COINBASE_BLOB_RESERVED_SIZE);
time_t const MIN_RELAY_TIME = (60 * 5); // only start re-relaying transactions after that many seconds
time_t const MAX_RELAY_TIME = (60 * 60 * 4); // at most that many seconds between resends
float const ACCEPT_THRESHOLD = 0.99f;
float const ACCEPT_THRESHOLD = 1.0f;

// a kind of increasing backoff within min/max bounds
time_t get_relay_delay(time_t now, time_t received)
Expand Down Expand Up @@ -253,7 +253,7 @@ namespace cryptonote

tvc.m_verifivation_failed = false;

m_txs_by_fee_and_receive_time.emplace(std::pair<double, std::time_t>((double)blob_size / fee, receive_time), id);
m_txs_by_fee_and_receive_time.emplace(std::pair<double, std::time_t>(fee / (double)blob_size, receive_time), id);

return true;
}
Expand Down Expand Up @@ -613,6 +613,10 @@ namespace cryptonote
uint64_t best_coinbase = 0;
total_size = 0;
fee = 0;

//baseline empty block
get_block_reward(median_size, total_size, already_generated_coins, best_coinbase, version);


size_t max_total_size = 2 * median_size - CRYPTONOTE_COINBASE_BLOB_RESERVED_SIZE;
std::unordered_set<crypto::key_image> k_images;
Expand Down Expand Up @@ -641,7 +645,7 @@ namespace cryptonote
sorted_it++;
continue;
}
uint64_t coinbase = block_reward + fee;
uint64_t coinbase = block_reward + fee + tx_it->second.fee;
if (coinbase < template_accept_threshold(best_coinbase))
{
LOG_PRINT_L2(" would decrease coinbase to " << print_money(coinbase));
Expand Down Expand Up @@ -728,7 +732,7 @@ namespace cryptonote
// no need to store queue of sorted transactions, as it's easy to generate.
for (const auto& tx : m_transactions)
{
m_txs_by_fee_and_receive_time.emplace(std::pair<double, time_t>((double)tx.second.blob_size / tx.second.fee, tx.second.receive_time), tx.first);
m_txs_by_fee_and_receive_time.emplace(std::pair<double, time_t>(tx.second.fee / (double)tx.second.blob_size, tx.second.receive_time), tx.first);
}

// Ignore deserialization error
Expand Down