From d72f405ceeb3e73bdf78408873be7d260d99191a Mon Sep 17 00:00:00 2001 From: j-berman Date: Thu, 8 Aug 2024 13:43:54 -0700 Subject: [PATCH] Revert DELETE_DB macro to original spot --- src/blockchain_db/lmdb/db_lmdb.cpp | 30 +++++++++++++----------------- 1 file changed, 13 insertions(+), 17 deletions(-) diff --git a/src/blockchain_db/lmdb/db_lmdb.cpp b/src/blockchain_db/lmdb/db_lmdb.cpp index 3a40e6d5c..e5808a29c 100644 --- a/src/blockchain_db/lmdb/db_lmdb.cpp +++ b/src/blockchain_db/lmdb/db_lmdb.cpp @@ -89,23 +89,6 @@ inline void throw1(const T &e) #define MDB_val_str(var, val) MDB_val var = {strlen(val) + 1, (void *)val} -#define DELETE_DB(x) do { \ - result = mdb_txn_begin(m_env, NULL, 0, txn); \ - if (result) \ - throw0(DB_ERROR(lmdb_error("Failed to create a transaction for the db: ", result).c_str())); \ - result = mdb_dbi_open(txn, x, 0, &dbi); \ - if (!result) { \ - result = mdb_drop(txn, dbi, 1); \ - if (result) \ - throw0(DB_ERROR(lmdb_error("Failed to delete " x ": ", result).c_str())); \ - txn.commit(); \ - } \ - else \ - { \ - txn.abort(); \ - }; \ - } while(0) - template struct MDB_val_copy: public MDB_val { @@ -5942,6 +5925,19 @@ void BlockchainLMDB::migrate_0_1() } txn.abort(); +#define DELETE_DB(x) do { \ + LOG_PRINT_L1(" " x ":"); \ + result = mdb_txn_begin(m_env, NULL, 0, txn); \ + if (result) \ + throw0(DB_ERROR(lmdb_error("Failed to create a transaction for the db: ", result).c_str())); \ + result = mdb_dbi_open(txn, x, 0, &dbi); \ + if (!result) { \ + result = mdb_drop(txn, dbi, 1); \ + if (result) \ + throw0(DB_ERROR(lmdb_error("Failed to delete " x ": ", result).c_str())); \ + txn.commit(); \ + } } while(0) + DELETE_DB("tx_heights"); DELETE_DB("output_txs"); DELETE_DB("output_indices");