Merge pull request #9404

f4672c259 cryptonote_core: only verify txpool when the hardfork value has changed. (0xFFFC0000)
This commit is contained in:
tobtoht 2025-04-24 16:13:01 +00:00
commit d2d976ca5a
No known key found for this signature in database
GPG key ID: E45B10DD027D2472

View file

@ -31,6 +31,7 @@
#include <boost/algorithm/string.hpp>
#include <boost/uuid/nil_generator.hpp>
#include "misc_log_ex.h"
#include "string_tools.h"
using namespace epee;
@ -664,9 +665,21 @@ namespace cryptonote
r = m_mempool.init(max_txpool_weight, m_nettype == FAKECHAIN);
CHECK_AND_ASSERT_MES(r, false, "Failed to initialize memory pool");
uint64_t session_start_height = m_blockchain_storage.get_current_blockchain_height() - 1; // use top block's height
uint8_t hardfork_version_start = m_blockchain_storage.get_hard_fork_version(session_start_height);
uint8_t hardfork_version_current = m_blockchain_storage.get_current_hard_fork_version();
MDEBUG("Current height: " << session_start_height);
MDEBUG("Start hardfork version: " << (int) hardfork_version_start);
MDEBUG("Current hardfork version: " << (int) hardfork_version_current);
// now that we have a valid m_blockchain_storage, we can clean out any
// transactions in the pool that do not conform to the current fork
m_mempool.validate(m_blockchain_storage.get_current_hard_fork_version());
if(hardfork_version_start != hardfork_version_current) {
m_mempool.validate(hardfork_version_current);
}
else {
MDEBUG("Not validating the txpool, no hardfork detected.");
}
bool show_time_stats = command_line::get_arg(vm, arg_show_time_stats) != 0;
m_blockchain_storage.set_show_time_stats(show_time_stats);