mirror of
https://github.com/monero-project/monero.git
synced 2024-11-17 08:17:37 +00:00
Fix hf when import with verify off
Delete the hf tables, so the next open will rescan and regenerate
This commit is contained in:
parent
810acab742
commit
30f92f5630
6 changed files with 30 additions and 0 deletions
|
@ -2150,6 +2150,11 @@ uint64_t BlockchainBDB::get_hard_fork_starting_height(uint8_t version) const
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void BlockchainBDB::check_hard_fork_info()
|
||||||
|
{
|
||||||
|
/* FIXME: Some other time */
|
||||||
|
}
|
||||||
|
|
||||||
void BlockchainBDB::set_hard_fork_version(uint64_t height, uint8_t version)
|
void BlockchainBDB::set_hard_fork_version(uint64_t height, uint8_t version)
|
||||||
{
|
{
|
||||||
LOG_PRINT_L3("BlockchainBDB::" << __func__);
|
LOG_PRINT_L3("BlockchainBDB::" << __func__);
|
||||||
|
|
|
@ -375,6 +375,7 @@ private:
|
||||||
virtual uint64_t get_hard_fork_starting_height(uint8_t version) const;
|
virtual uint64_t get_hard_fork_starting_height(uint8_t version) const;
|
||||||
virtual void set_hard_fork_version(uint64_t height, uint8_t version);
|
virtual void set_hard_fork_version(uint64_t height, uint8_t version);
|
||||||
virtual uint8_t get_hard_fork_version(uint64_t height) const;
|
virtual uint8_t get_hard_fork_version(uint64_t height) const;
|
||||||
|
virtual void check_hard_fork_info();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief convert a tx output to a blob for storage
|
* @brief convert a tx output to a blob for storage
|
||||||
|
|
|
@ -502,6 +502,7 @@ public:
|
||||||
virtual uint64_t get_hard_fork_starting_height(uint8_t version) const = 0;
|
virtual uint64_t get_hard_fork_starting_height(uint8_t version) const = 0;
|
||||||
virtual void set_hard_fork_version(uint64_t height, uint8_t version) = 0;
|
virtual void set_hard_fork_version(uint64_t height, uint8_t version) = 0;
|
||||||
virtual uint8_t get_hard_fork_version(uint64_t height) const = 0;
|
virtual uint8_t get_hard_fork_version(uint64_t height) const = 0;
|
||||||
|
virtual void check_hard_fork_info() = 0;
|
||||||
|
|
||||||
virtual bool is_read_only() const = 0;
|
virtual bool is_read_only() const = 0;
|
||||||
|
|
||||||
|
|
|
@ -2434,6 +2434,27 @@ void BlockchainLMDB::get_output_tx_and_index(const uint64_t& amount, const std::
|
||||||
LOG_PRINT_L3("db3: " << db3);
|
LOG_PRINT_L3("db3: " << db3);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void BlockchainLMDB::check_hard_fork_info()
|
||||||
|
{
|
||||||
|
LOG_PRINT_L3("BlockchainLMDB::" << __func__);
|
||||||
|
check_open();
|
||||||
|
|
||||||
|
TXN_PREFIX(0);
|
||||||
|
|
||||||
|
MDB_stat db_stat1, db_stat2;
|
||||||
|
if (mdb_stat(*txn_ptr, m_blocks, &db_stat1))
|
||||||
|
throw0(DB_ERROR("Failed to query m_blocks"));
|
||||||
|
if (mdb_stat(*txn_ptr, m_hf_versions, &db_stat2))
|
||||||
|
throw0(DB_ERROR("Failed to query m_hf_starting_heights"));
|
||||||
|
if (db_stat1.ms_entries != db_stat2.ms_entries)
|
||||||
|
{
|
||||||
|
mdb_drop(*txn_ptr, m_hf_starting_heights, 1);
|
||||||
|
mdb_drop(*txn_ptr, m_hf_versions, 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
TXN_POSTFIX_SUCCESS();
|
||||||
|
}
|
||||||
|
|
||||||
void BlockchainLMDB::set_hard_fork_starting_height(uint8_t version, uint64_t height)
|
void BlockchainLMDB::set_hard_fork_starting_height(uint8_t version, uint64_t height)
|
||||||
{
|
{
|
||||||
LOG_PRINT_L3("BlockchainLMDB::" << __func__);
|
LOG_PRINT_L3("BlockchainLMDB::" << __func__);
|
||||||
|
|
|
@ -235,6 +235,7 @@ private:
|
||||||
virtual uint64_t get_hard_fork_starting_height(uint8_t version) const;
|
virtual uint64_t get_hard_fork_starting_height(uint8_t version) const;
|
||||||
virtual void set_hard_fork_version(uint64_t height, uint8_t version);
|
virtual void set_hard_fork_version(uint64_t height, uint8_t version);
|
||||||
virtual uint8_t get_hard_fork_version(uint64_t height) const;
|
virtual uint8_t get_hard_fork_version(uint64_t height) const;
|
||||||
|
virtual void check_hard_fork_info();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief convert a tx output to a blob for storage
|
* @brief convert a tx output to a blob for storage
|
||||||
|
|
|
@ -83,6 +83,7 @@ struct fake_core_lmdb
|
||||||
}
|
}
|
||||||
~fake_core_lmdb()
|
~fake_core_lmdb()
|
||||||
{
|
{
|
||||||
|
m_storage.get_db().check_hard_fork_info();
|
||||||
m_storage.deinit();
|
m_storage.deinit();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue