Skip to content

Commit

Permalink
Remove database upgrades pre node v22 (#4292)
Browse files Browse the repository at this point in the history
Removing old upgrade paths before database version 21, node version 22.
  • Loading branch information
clemahieu authored Sep 22, 2023
1 parent fc36682 commit a40bdcd
Show file tree
Hide file tree
Showing 7 changed files with 8 additions and 2,010 deletions.
895 changes: 1 addition & 894 deletions nano/core_test/block_store.cpp

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion nano/store/component.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ namespace store
store::frontier & frontier;
store::account & account;
store::pending & pending;
static int constexpr version_minimum{ 14 };
static int constexpr version_minimum{ 21 };
static int constexpr version_current{ 22 };

public:
Expand Down
57 changes: 0 additions & 57 deletions nano/store/db_val.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -57,23 +57,12 @@ class db_val
{
}

db_val (account_info_v14 const & val_a) :
db_val (val_a.db_size (), const_cast<account_info_v14 *> (&val_a))
{
}

db_val (nano::pending_info const & val_a) :
db_val (val_a.db_size (), const_cast<nano::pending_info *> (&val_a))
{
static_assert (std::is_standard_layout<nano::pending_info>::value, "Standard layout is required");
}

db_val (pending_info_v14 const & val_a) :
db_val (val_a.db_size (), const_cast<pending_info_v14 *> (&val_a))
{
static_assert (std::is_standard_layout<pending_info_v14>::value, "Standard layout is required");
}

db_val (nano::pending_key const & val_a) :
db_val (sizeof (val_a), const_cast<nano::pending_key *> (&val_a))
{
Expand Down Expand Up @@ -131,14 +120,6 @@ class db_val
return result;
}

explicit operator account_info_v14 () const
{
account_info_v14 result;
debug_assert (size () == result.db_size ());
std::copy (reinterpret_cast<uint8_t const *> (data ()), reinterpret_cast<uint8_t const *> (data ()) + result.db_size (), reinterpret_cast<uint8_t *> (&result));
return result;
}

explicit operator block_info () const
{
nano::block_info result;
Expand All @@ -148,14 +129,6 @@ class db_val
return result;
}

explicit operator pending_info_v14 () const
{
pending_info_v14 result;
debug_assert (size () == result.db_size ());
std::copy (reinterpret_cast<uint8_t const *> (data ()), reinterpret_cast<uint8_t const *> (data ()) + result.db_size (), reinterpret_cast<uint8_t *> (&result));
return result;
}

explicit operator nano::pending_info () const
{
nano::pending_info result;
Expand Down Expand Up @@ -235,21 +208,6 @@ class db_val
return result;
}

template <class Block>
explicit operator block_w_sideband_v18<Block> () const
{
nano::bufferstream stream (reinterpret_cast<uint8_t const *> (data ()), size ());
auto error (false);
block_w_sideband_v18<Block> block_w_sideband;
block_w_sideband.block = std::make_shared<Block> (error, stream);
release_assert (!error);

error = block_w_sideband.sideband.deserialize (stream, block_w_sideband.block->type ());
release_assert (!error);

return block_w_sideband;
}

explicit operator block_w_sideband () const
{
nano::bufferstream stream (reinterpret_cast<uint8_t const *> (data ()), size ());
Expand All @@ -261,21 +219,6 @@ class db_val
return block_w_sideband;
}

explicit operator state_block_w_sideband_v14 () const
{
nano::bufferstream stream (reinterpret_cast<uint8_t const *> (data ()), size ());
auto error (false);
state_block_w_sideband_v14 block_w_sideband;
block_w_sideband.state_block = std::make_shared<nano::state_block> (error, stream);
debug_assert (!error);

block_w_sideband.sideband.type = nano::block_type::state;
error = block_w_sideband.sideband.deserialize (stream);
debug_assert (!error);

return block_w_sideband;
}

explicit operator std::nullptr_t () const
{
return nullptr;
Expand Down
Loading

0 comments on commit a40bdcd

Please sign in to comment.