aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorluigi1111 <luigi1111w@gmail.com>2020-06-22 14:23:41 -0500
committerluigi1111 <luigi1111w@gmail.com>2020-06-22 14:23:41 -0500
commitcd9acb3a5b169797b812b7096698d3c9afa9c17f (patch)
treefed859d7a86bc52d001b7d5c3975c461090bccb8
parentMerge pull request #6665 (diff)
parenttx_pool: mine stem txes in fake chain mode (diff)
downloadmonero-cd9acb3a5b169797b812b7096698d3c9afa9c17f.tar.xz
Merge pull request #6671
bca61e4 tx_pool: mine stem txes in fake chain mode (moneromooo-monero)
-rw-r--r--src/cryptonote_core/cryptonote_core.cpp2
-rw-r--r--src/cryptonote_core/tx_pool.cpp14
-rw-r--r--src/cryptonote_core/tx_pool.h4
3 files changed, 14 insertions, 6 deletions
diff --git a/src/cryptonote_core/cryptonote_core.cpp b/src/cryptonote_core/cryptonote_core.cpp
index a2f975d4f..5aed708d5 100644
--- a/src/cryptonote_core/cryptonote_core.cpp
+++ b/src/cryptonote_core/cryptonote_core.cpp
@@ -650,7 +650,7 @@ namespace cryptonote
r = m_blockchain_storage.init(db.release(), m_nettype, m_offline, regtest ? &regtest_test_options : test_options, fixed_difficulty, get_checkpoints);
CHECK_AND_ASSERT_MES(r, false, "Failed to initialize blockchain storage");
- r = m_mempool.init(max_txpool_weight);
+ r = m_mempool.init(max_txpool_weight, m_nettype == FAKECHAIN);
CHECK_AND_ASSERT_MES(r, false, "Failed to initialize memory pool");
// now that we have a valid m_blockchain_storage, we can clean out any
diff --git a/src/cryptonote_core/tx_pool.cpp b/src/cryptonote_core/tx_pool.cpp
index f95645abd..696bc88d4 100644
--- a/src/cryptonote_core/tx_pool.cpp
+++ b/src/cryptonote_core/tx_pool.cpp
@@ -116,7 +116,7 @@ namespace cryptonote
}
//---------------------------------------------------------------------------------
//---------------------------------------------------------------------------------
- tx_memory_pool::tx_memory_pool(Blockchain& bchs): m_blockchain(bchs), m_txpool_max_weight(DEFAULT_TXPOOL_MAX_WEIGHT), m_txpool_weight(0), m_cookie(0)
+ tx_memory_pool::tx_memory_pool(Blockchain& bchs): m_blockchain(bchs), m_cookie(0), m_txpool_max_weight(DEFAULT_TXPOOL_MAX_WEIGHT), m_txpool_weight(0), m_mine_stem_txes(false)
{
}
@@ -1351,13 +1351,18 @@ namespace cryptonote
for (; sorted_it != m_txs_by_fee_and_receive_time.end(); ++sorted_it)
{
txpool_tx_meta_t meta;
- if (!m_blockchain.get_txpool_tx_meta(sorted_it->second, meta) || !meta.matches(relay_category::legacy))
+ if (!m_blockchain.get_txpool_tx_meta(sorted_it->second, meta))
{
MERROR(" failed to find tx meta");
continue;
}
- LOG_PRINT_L2("Considering " << sorted_it->second << ", weight " << meta.weight << ", current block weight " << total_weight << "/" << max_total_weight << ", current coinbase " << print_money(best_coinbase));
+ LOG_PRINT_L2("Considering " << sorted_it->second << ", weight " << meta.weight << ", current block weight " << total_weight << "/" << max_total_weight << ", current coinbase " << print_money(best_coinbase) << ", relay method " << (unsigned)meta.get_relay_method());
+ if (!meta.matches(relay_category::legacy) && !(m_mine_stem_txes && meta.get_relay_method() == relay_method::stem))
+ {
+ LOG_PRINT_L2(" tx relay method is " << (unsigned)meta.get_relay_method());
+ continue;
+ }
if (meta.pruned)
{
LOG_PRINT_L2(" tx is pruned");
@@ -1522,7 +1527,7 @@ namespace cryptonote
return n_removed;
}
//---------------------------------------------------------------------------------
- bool tx_memory_pool::init(size_t max_txpool_weight)
+ bool tx_memory_pool::init(size_t max_txpool_weight, bool mine_stem_txes)
{
CRITICAL_REGION_LOCAL(m_transactions_lock);
CRITICAL_REGION_LOCAL1(m_blockchain);
@@ -1578,6 +1583,7 @@ namespace cryptonote
lock.commit();
}
+ m_mine_stem_txes = mine_stem_txes;
m_cookie = 0;
// Ignore deserialization error
diff --git a/src/cryptonote_core/tx_pool.h b/src/cryptonote_core/tx_pool.h
index 292d427e2..18ef0340b 100644
--- a/src/cryptonote_core/tx_pool.h
+++ b/src/cryptonote_core/tx_pool.h
@@ -205,10 +205,11 @@ namespace cryptonote
* @brief loads pool state (if any) from disk, and initializes pool
*
* @param max_txpool_weight the max weight in bytes
+ * @param mine_stem_txes whether to mine txes in stem relay mode
*
* @return true
*/
- bool init(size_t max_txpool_weight = 0);
+ bool init(size_t max_txpool_weight = 0, bool mine_stem_txes = false);
/**
* @brief attempts to save the transaction pool state to disk
@@ -603,6 +604,7 @@ private:
size_t m_txpool_max_weight;
size_t m_txpool_weight;
+ bool m_mine_stem_txes;
mutable std::unordered_map<crypto::hash, std::tuple<bool, tx_verification_context, uint64_t, crypto::hash>> m_input_cache;