mirror of
https://github.com/monero-project/monero.git
synced 2024-12-23 20:19:34 +00:00
db_lmdb: update reset for recent db changes
- we need to drop the new m_tx_indices database - we reset the version to current version This fixes the core tests failing to initialize.
This commit is contained in:
parent
dee42d6dac
commit
211d1db762
1 changed files with 10 additions and 0 deletions
|
@ -1240,6 +1240,7 @@ void BlockchainLMDB::reset()
|
|||
mdb_txn_safe txn;
|
||||
if (auto result = mdb_txn_begin(m_env, NULL, 0, txn))
|
||||
throw0(DB_ERROR(lmdb_error("Failed to create a transaction for the db: ", result).c_str()));
|
||||
|
||||
if (auto result = mdb_drop(txn, m_blocks, 0))
|
||||
throw0(DB_ERROR(lmdb_error("Failed to drop m_blocks: ", result).c_str()));
|
||||
if (auto result = mdb_drop(txn, m_block_info, 0))
|
||||
|
@ -1248,6 +1249,8 @@ void BlockchainLMDB::reset()
|
|||
throw0(DB_ERROR(lmdb_error("Failed to drop m_block_heights: ", result).c_str()));
|
||||
if (auto result = mdb_drop(txn, m_txs, 0))
|
||||
throw0(DB_ERROR(lmdb_error("Failed to drop m_txs: ", result).c_str()));
|
||||
if (auto result = mdb_drop(txn, m_tx_indices, 0))
|
||||
throw0(DB_ERROR(lmdb_error("Failed to drop m_tx_indices: ", result).c_str()));
|
||||
if (auto result = mdb_drop(txn, m_tx_outputs, 0))
|
||||
throw0(DB_ERROR(lmdb_error("Failed to drop m_tx_outputs: ", result).c_str()));
|
||||
if (auto result = mdb_drop(txn, m_output_txs, 0))
|
||||
|
@ -1263,6 +1266,13 @@ void BlockchainLMDB::reset()
|
|||
throw0(DB_ERROR(lmdb_error("Failed to drop m_hf_versions: ", result).c_str()));
|
||||
if (auto result = mdb_drop(txn, m_properties, 0))
|
||||
throw0(DB_ERROR(lmdb_error("Failed to drop m_properties: ", result).c_str()));
|
||||
|
||||
// init with current version
|
||||
MDB_val_copy<const char*> k("version");
|
||||
MDB_val_copy<uint32_t> v(VERSION);
|
||||
if (auto result = mdb_put(txn, m_properties, &k, &v, 0))
|
||||
throw0(DB_ERROR(lmdb_error("Failed to write version to database: ", result).c_str()));
|
||||
|
||||
txn.commit();
|
||||
m_height = 0;
|
||||
m_num_outputs = 0;
|
||||
|
|
Loading…
Reference in a new issue