From 41099e588da8a7b437ea658978a0c838e075cfab Mon Sep 17 00:00:00 2001 From: Colin LeMahieu Date: Mon, 25 Sep 2023 13:31:54 +0100 Subject: [PATCH] Remove legacy upgrade code from lmdb store. --- nano/store/lmdb/block.hpp | 42 --------------------------------------- nano/store/lmdb/lmdb.cpp | 36 +-------------------------------- 2 files changed, 1 insertion(+), 77 deletions(-) diff --git a/nano/store/lmdb/block.hpp b/nano/store/lmdb/block.hpp index 02c9810ea5..a16f213859 100644 --- a/nano/store/lmdb/block.hpp +++ b/nano/store/lmdb/block.hpp @@ -36,48 +36,6 @@ class block : public nano::store::block store::iterator end () const override; void for_each_par (std::function, store::iterator)> const & action_a) const override; - /** - * Maps block hash to send block. (Removed) - * nano::block_hash -> nano::send_block - */ - MDB_dbi send_blocks_handle{ 0 }; - - /** - * Maps block hash to receive block. (Removed) - * nano::block_hash -> nano::receive_block - */ - MDB_dbi receive_blocks_handle{ 0 }; - - /** - * Maps block hash to open block. (Removed) - * nano::block_hash -> nano::open_block - */ - MDB_dbi open_blocks_handle{ 0 }; - - /** - * Maps block hash to change block. (Removed) - * nano::block_hash -> nano::change_block - */ - MDB_dbi change_blocks_handle{ 0 }; - - /** - * Maps block hash to v0 state block. (Removed) - * nano::block_hash -> nano::state_block - */ - MDB_dbi state_blocks_v0_handle{ 0 }; - - /** - * Maps block hash to v1 state block. (Removed) - * nano::block_hash -> nano::state_block - */ - MDB_dbi state_blocks_v1_handle{ 0 }; - - /** - * Maps block hash to state block. (Removed) - * nano::block_hash -> nano::state_block - */ - MDB_dbi state_blocks_handle{ 0 }; - /** * Contains block_sideband and block for all block types (legacy send/change/open/receive & state blocks) * nano::block_hash -> nano::block_sideband, nano::block diff --git a/nano/store/lmdb/lmdb.cpp b/nano/store/lmdb/lmdb.cpp index 310ef25c48..6bf1539980 100644 --- a/nano/store/lmdb/lmdb.cpp +++ b/nano/store/lmdb/lmdb.cpp @@ -194,41 +194,7 @@ void nano::store::lmdb::component::open_databases (bool & error_a, store::transa error_a |= mdb_dbi_open (env.tx (transaction_a), "pending", flags, &pending_store.pending_v0_handle) != 0; pending_store.pending_handle = pending_store.pending_v0_handle; error_a |= mdb_dbi_open (env.tx (transaction_a), "final_votes", flags, &final_vote_store.final_votes_handle) != 0; - - auto version_l = version.get (transaction_a); - if (version_l < 19) - { - // These legacy (and state) block databases are no longer used, but need opening so they can be deleted during an upgrade - error_a |= mdb_dbi_open (env.tx (transaction_a), "send", flags, &block_store.send_blocks_handle) != 0; - error_a |= mdb_dbi_open (env.tx (transaction_a), "receive", flags, &block_store.receive_blocks_handle) != 0; - error_a |= mdb_dbi_open (env.tx (transaction_a), "open", flags, &block_store.open_blocks_handle) != 0; - error_a |= mdb_dbi_open (env.tx (transaction_a), "change", flags, &block_store.change_blocks_handle) != 0; - if (version_l >= 15) - { - error_a |= mdb_dbi_open (env.tx (transaction_a), "state_blocks", flags, &block_store.state_blocks_handle) != 0; - block_store.state_blocks_v0_handle = block_store.state_blocks_handle; - } - } - else - { - error_a |= mdb_dbi_open (env.tx (transaction_a), "blocks", MDB_CREATE, &block_store.blocks_handle) != 0; - } - - if (version_l < 16) - { - // The representation database is no longer used, but needs opening so that it can be deleted during an upgrade - error_a |= mdb_dbi_open (env.tx (transaction_a), "representation", flags, &account_store.representation_handle) != 0; - } - - if (version_l < 15) - { - // These databases are no longer used, but need opening so they can be deleted during an upgrade - error_a |= mdb_dbi_open (env.tx (transaction_a), "state", flags, &block_store.state_blocks_v0_handle) != 0; - block_store.state_blocks_handle = block_store.state_blocks_v0_handle; - error_a |= mdb_dbi_open (env.tx (transaction_a), "accounts_v1", flags, &account_store.accounts_v1_handle) != 0; - error_a |= mdb_dbi_open (env.tx (transaction_a), "pending_v1", flags, &pending_store.pending_v1_handle) != 0; - error_a |= mdb_dbi_open (env.tx (transaction_a), "state_v1", flags, &block_store.state_blocks_v1_handle) != 0; - } + error_a |= mdb_dbi_open (env.tx (transaction_a), "blocks", MDB_CREATE, &block_store.blocks_handle) != 0; } bool nano::store::lmdb::component::do_upgrades (store::write_transaction & transaction_a, nano::ledger_constants & constants, bool & needs_vacuuming)