aboutsummaryrefslogtreecommitdiff
path: root/src/blockchain_db/berkeleydb
diff options
context:
space:
mode:
authormoneromooo-monero <moneromooo-monero@users.noreply.github.com>2015-12-06 20:48:17 +0000
committermoneromooo-monero <moneromooo-monero@users.noreply.github.com>2015-12-06 21:55:05 +0000
commita98e976f9eabf2112a75347147becc1956ef8d66 (patch)
treec7ee89c4b09ee601a829cd60d76b4c81cc41a694 /src/blockchain_db/berkeleydb
parentMerge pull request #518 (diff)
downloadmonero-a98e976f9eabf2112a75347147becc1956ef8d66.tar.xz
blockchain_db: fixup missing key images in early DB version
Early DB versions did not store key images for inputs if the transaction spending them had no outputs (ie, all fee). This is not correct, as this would allow these outputs to be double spent. This was fixed in 533acc30eda7792c802ea8b6417917fa99b8bc2b a few months ago, but databases having synced blocks 2021612 and 685498 with a faulty version will be missing those key images in the spent keys database. This code checks for this, and adds those key images if they are missing.
Diffstat (limited to 'src/blockchain_db/berkeleydb')
-rw-r--r--src/blockchain_db/berkeleydb/db_bdb.cpp6
-rw-r--r--src/blockchain_db/berkeleydb/db_bdb.h4
2 files changed, 10 insertions, 0 deletions
diff --git a/src/blockchain_db/berkeleydb/db_bdb.cpp b/src/blockchain_db/berkeleydb/db_bdb.cpp
index 486b63a3e..7bf35db0b 100644
--- a/src/blockchain_db/berkeleydb/db_bdb.cpp
+++ b/src/blockchain_db/berkeleydb/db_bdb.cpp
@@ -2123,4 +2123,10 @@ void BlockchainBDB::checkpoint_worker() const
LOG_PRINT_L0("Leaving BDB checkpoint thread.")
}
+void BlockchainBDB::fixup()
+{
+ // Always call parent as well
+ BlockchainDB::fixup();
+}
+
} // namespace cryptonote
diff --git a/src/blockchain_db/berkeleydb/db_bdb.h b/src/blockchain_db/berkeleydb/db_bdb.h
index d05abea25..c79d8b26f 100644
--- a/src/blockchain_db/berkeleydb/db_bdb.h
+++ b/src/blockchain_db/berkeleydb/db_bdb.h
@@ -405,6 +405,10 @@ private:
uint64_t get_output_global_index(const uint64_t& amount, const uint64_t& index);
void checkpoint_worker() const;
void check_open() const;
+ //
+ // fix up anything that may be wrong due to past bugs
+ virtual void fixup();
+
bool m_run_checkpoint;
std::unique_ptr<boost::thread> m_checkpoint_thread;
typedef bdb_safe_buffer<void *> bdb_safe_buffer_t;