diff --git a/src/block_template.cpp b/src/block_template.cpp index b67501b..f0d6db9 100644 --- a/src/block_template.cpp +++ b/src/block_template.cpp @@ -260,7 +260,7 @@ void BlockTemplate::update(const MinerData& data, const Mempool& mempool, Wallet m_sidechain->fill_sidechain_data(*m_poolBlockTemplate, miner_wallet, m_txkeySec, m_shares); - // Only choose transactions that were received 10 or more seconds ago + // Only choose transactions that were received 10 or more seconds ago, or high fee (>= 0.006 XMR) transactions size_t total_mempool_transactions; { m_mempoolTxs.clear(); @@ -272,7 +272,7 @@ void BlockTemplate::update(const MinerData& data, const Mempool& mempool, Wallet const uint64_t cur_time = seconds_since_epoch(); for (auto& it : mempool.m_transactions) { - if (cur_time >= it.second.time_received + 10) { + if ((cur_time >= it.second.time_received + 10) || (it.second.fee >= HIGH_FEE_VALUE)) { m_mempoolTxs.emplace_back(it.second); } } diff --git a/src/mempool.h b/src/mempool.h index 0b1fdb6..018bc6f 100644 --- a/src/mempool.h +++ b/src/mempool.h @@ -21,6 +21,8 @@ namespace p2pool { +constexpr uint64_t HIGH_FEE_VALUE = 6000000000ULL; + class p2pool; class Mempool : public nocopy_nomove diff --git a/src/p2pool.cpp b/src/p2pool.cpp index 253e371..723cff9 100644 --- a/src/p2pool.cpp +++ b/src/p2pool.cpp @@ -244,6 +244,11 @@ void p2pool::handle_tx(TxMempoolData& tx) ", weight = " << log::Gray() << tx.weight << log::NoColor() << ", fee = " << log::Gray() << static_cast(tx.fee) / 1e6 << " um"); + if (tx.fee >= HIGH_FEE_VALUE) { + LOGINFO(4, "high fee tx received: " << log::LightBlue() << tx.id << log::NoColor() << ", " << log::XMRAmount(tx.fee) << " - updating block template"); + update_block_template_async(); + } + #if TEST_MEMPOOL_PICKING_ALGORITHM m_blockTemplate->update(miner_data(), *m_mempool, &m_params->m_wallet); #endif