mirror of
https://github.com/monero-project/monero.git
synced 2025-01-09 01:27:52 -05:00
Revert DELETE_DB macro to original spot
This commit is contained in:
parent
3a5cf70066
commit
d72f405cee
@ -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 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<typename T>
|
template<typename T>
|
||||||
struct MDB_val_copy: public MDB_val
|
struct MDB_val_copy: public MDB_val
|
||||||
{
|
{
|
||||||
@ -5942,6 +5925,19 @@ void BlockchainLMDB::migrate_0_1()
|
|||||||
}
|
}
|
||||||
txn.abort();
|
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("tx_heights");
|
||||||
DELETE_DB("output_txs");
|
DELETE_DB("output_txs");
|
||||||
DELETE_DB("output_indices");
|
DELETE_DB("output_indices");
|
||||||
|
Loading…
Reference in New Issue
Block a user