From 1c578ad3f8ad57b291a4f651ef897120f7735b20 Mon Sep 17 00:00:00 2001 From: moneromooo-monero Date: Thu, 11 Dec 2014 19:36:27 +0000 Subject: [PATCH] db_lmdb: remove block timestamp too when removing a block --- src/cryptonote_core/BlockchainDB_impl/db_lmdb.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/cryptonote_core/BlockchainDB_impl/db_lmdb.cpp b/src/cryptonote_core/BlockchainDB_impl/db_lmdb.cpp index 701b80a2..3b4de0a6 100644 --- a/src/cryptonote_core/BlockchainDB_impl/db_lmdb.cpp +++ b/src/cryptonote_core/BlockchainDB_impl/db_lmdb.cpp @@ -269,6 +269,12 @@ void BlockchainLMDB::remove_block() throw DB_ERROR("Failed to add removal of block total generated coins to db transaction"); } + if (mdb_del(*m_write_txn, m_block_timestamps, &k, NULL)) + { + LOG_PRINT_L1("Failed to add removal of block timestamp to db transaction"); + throw DB_ERROR("Failed to add removal of block timestamp to db transaction"); + } + if (mdb_del(*m_write_txn, m_block_heights, &h, NULL)) { LOG_PRINT_L1("Failed to add removal of block height by hash to db transaction");