Merge pull request #4216 from thsfs/remove_unchecked_table_from_db
Remove the unchecked table code from the store classes
This commit is contained in:
		
				commit
				
					
						2dd63458c5
					
				
			
		
					 18 changed files with 38 additions and 358 deletions
				
			
		| 
						 | 
					@ -447,9 +447,7 @@ TEST (block_store, empty_bootstrap)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	nano::test::system system{};
 | 
						nano::test::system system{};
 | 
				
			||||||
	nano::logger_mt logger;
 | 
						nano::logger_mt logger;
 | 
				
			||||||
	auto store = nano::make_store (logger, nano::unique_path (), nano::dev::constants);
 | 
						nano::unchecked_map unchecked{ system.stats, false };
 | 
				
			||||||
	nano::unchecked_map unchecked{ *store, system.stats, false };
 | 
					 | 
				
			||||||
	ASSERT_TRUE (!store->init_error ());
 | 
					 | 
				
			||||||
	size_t count = 0;
 | 
						size_t count = 0;
 | 
				
			||||||
	unchecked.for_each ([&count] (nano::unchecked_key const & key, nano::unchecked_info const & info) {
 | 
						unchecked.for_each ([&count] (nano::unchecked_key const & key, nano::unchecked_info const & info) {
 | 
				
			||||||
		++count;
 | 
							++count;
 | 
				
			||||||
| 
						 | 
					@ -961,54 +959,6 @@ TEST (block_store, pruned_random)
 | 
				
			||||||
	ASSERT_EQ (hash1, random_hash);
 | 
						ASSERT_EQ (hash1, random_hash);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
namespace nano
 | 
					 | 
				
			||||||
{
 | 
					 | 
				
			||||||
namespace lmdb
 | 
					 | 
				
			||||||
{
 | 
					 | 
				
			||||||
	// Databases need to be dropped in order to convert to dupsort compatible
 | 
					 | 
				
			||||||
	TEST (block_store, DISABLED_change_dupsort) // Unchecked is no longer dupsort table
 | 
					 | 
				
			||||||
	{
 | 
					 | 
				
			||||||
		nano::test::system system{};
 | 
					 | 
				
			||||||
		auto path (nano::unique_path ());
 | 
					 | 
				
			||||||
		nano::logger_mt logger{};
 | 
					 | 
				
			||||||
		nano::lmdb::store store{ logger, path, nano::dev::constants };
 | 
					 | 
				
			||||||
		nano::unchecked_map unchecked{ store, system.stats, false };
 | 
					 | 
				
			||||||
		auto transaction (store.tx_begin_write ());
 | 
					 | 
				
			||||||
		ASSERT_EQ (0, mdb_drop (store.env.tx (transaction), store.unchecked_store.unchecked_handle, 1));
 | 
					 | 
				
			||||||
		ASSERT_EQ (0, mdb_dbi_open (store.env.tx (transaction), "unchecked", MDB_CREATE, &store.unchecked_store.unchecked_handle));
 | 
					 | 
				
			||||||
		nano::block_builder builder;
 | 
					 | 
				
			||||||
		auto send1 = builder
 | 
					 | 
				
			||||||
					 .send ()
 | 
					 | 
				
			||||||
					 .previous (0)
 | 
					 | 
				
			||||||
					 .destination (0)
 | 
					 | 
				
			||||||
					 .balance (0)
 | 
					 | 
				
			||||||
					 .sign (nano::dev::genesis_key.prv, nano::dev::genesis_key.pub)
 | 
					 | 
				
			||||||
					 .work (0)
 | 
					 | 
				
			||||||
					 .build_shared ();
 | 
					 | 
				
			||||||
		auto send2 = builder
 | 
					 | 
				
			||||||
					 .send ()
 | 
					 | 
				
			||||||
					 .previous (1)
 | 
					 | 
				
			||||||
					 .destination (0)
 | 
					 | 
				
			||||||
					 .balance (0)
 | 
					 | 
				
			||||||
					 .sign (nano::dev::genesis_key.prv, nano::dev::genesis_key.pub)
 | 
					 | 
				
			||||||
					 .work (0)
 | 
					 | 
				
			||||||
					 .build_shared ();
 | 
					 | 
				
			||||||
		ASSERT_NE (send1->hash (), send2->hash ());
 | 
					 | 
				
			||||||
		unchecked.put (send1->hash (), nano::unchecked_info (send1));
 | 
					 | 
				
			||||||
		unchecked.put (send1->hash (), nano::unchecked_info (send2));
 | 
					 | 
				
			||||||
		ASSERT_EQ (0, mdb_drop (store.env.tx (transaction), store.unchecked_store.unchecked_handle, 0));
 | 
					 | 
				
			||||||
		mdb_dbi_close (store.env, store.unchecked_store.unchecked_handle);
 | 
					 | 
				
			||||||
		ASSERT_EQ (0, mdb_dbi_open (store.env.tx (transaction), "unchecked", MDB_CREATE | MDB_DUPSORT, &store.unchecked_store.unchecked_handle));
 | 
					 | 
				
			||||||
		unchecked.put (send1->hash (), nano::unchecked_info (send1));
 | 
					 | 
				
			||||||
		unchecked.put (send1->hash (), nano::unchecked_info (send2));
 | 
					 | 
				
			||||||
		ASSERT_EQ (0, mdb_drop (store.env.tx (transaction), store.unchecked_store.unchecked_handle, 1));
 | 
					 | 
				
			||||||
		ASSERT_EQ (0, mdb_dbi_open (store.env.tx (transaction), "unchecked", MDB_CREATE | MDB_DUPSORT, &store.unchecked_store.unchecked_handle));
 | 
					 | 
				
			||||||
		unchecked.put (send1->hash (), nano::unchecked_info (send1));
 | 
					 | 
				
			||||||
		unchecked.put (send1->hash (), nano::unchecked_info (send2));
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
TEST (block_store, state_block)
 | 
					TEST (block_store, state_block)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	nano::logger_mt logger;
 | 
						nano::logger_mt logger;
 | 
				
			||||||
| 
						 | 
					@ -2442,7 +2392,7 @@ TEST (rocksdb_block_store, tombstone_count)
 | 
				
			||||||
	{
 | 
						{
 | 
				
			||||||
		GTEST_SKIP ();
 | 
							GTEST_SKIP ();
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	nano::test::system system{};
 | 
						nano::test::system system;
 | 
				
			||||||
	nano::logger_mt logger;
 | 
						nano::logger_mt logger;
 | 
				
			||||||
	auto store = std::make_unique<nano::rocksdb::store> (logger, nano::unique_path (), nano::dev::constants);
 | 
						auto store = std::make_unique<nano::rocksdb::store> (logger, nano::unique_path (), nano::dev::constants);
 | 
				
			||||||
	ASSERT_TRUE (!store->init_error ());
 | 
						ASSERT_TRUE (!store->init_error ());
 | 
				
			||||||
| 
						 | 
					@ -2456,18 +2406,17 @@ TEST (rocksdb_block_store, tombstone_count)
 | 
				
			||||||
				 .work (5)
 | 
									 .work (5)
 | 
				
			||||||
				 .build_shared ();
 | 
									 .build_shared ();
 | 
				
			||||||
	// Enqueues a block to be saved in the database
 | 
						// Enqueues a block to be saved in the database
 | 
				
			||||||
	auto previous = block->previous ();
 | 
						nano::account account{ 1 };
 | 
				
			||||||
	store->unchecked.put (store->tx_begin_write (), previous, nano::unchecked_info (block));
 | 
						store->account.put (store->tx_begin_write (), account, nano::account_info{});
 | 
				
			||||||
	nano::unchecked_key key{ previous, block->hash () };
 | 
					 | 
				
			||||||
	auto check_block_is_listed = [&] (nano::transaction const & transaction_a) {
 | 
						auto check_block_is_listed = [&] (nano::transaction const & transaction_a) {
 | 
				
			||||||
		return store->unchecked.exists (transaction_a, key);
 | 
							return store->account.exists (transaction_a, account);
 | 
				
			||||||
	};
 | 
						};
 | 
				
			||||||
	// Waits for the block to get saved
 | 
						// Waits for the block to get saved
 | 
				
			||||||
	ASSERT_TIMELY (5s, check_block_is_listed (store->tx_begin_read ()));
 | 
						ASSERT_TIMELY (5s, check_block_is_listed (store->tx_begin_read ()));
 | 
				
			||||||
	ASSERT_EQ (store->tombstone_map.at (nano::tables::unchecked).num_since_last_flush.load (), 0);
 | 
						ASSERT_EQ (store->tombstone_map.at (nano::tables::accounts).num_since_last_flush.load (), 0);
 | 
				
			||||||
	// Perorms a delete and checks for the tombstone counter
 | 
						// Performs a delete operation and checks for the tombstone counter
 | 
				
			||||||
	store->unchecked.del (store->tx_begin_write (), nano::unchecked_key (previous, block->hash ()));
 | 
						store->account.del (store->tx_begin_write (), account);
 | 
				
			||||||
	ASSERT_TIMELY (5s, store->tombstone_map.at (nano::tables::unchecked).num_since_last_flush.load () == 1);
 | 
						ASSERT_TIMELY (5s, store->tombstone_map.at (nano::tables::accounts).num_since_last_flush.load () == 1);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -5541,7 +5541,7 @@ TEST (ledger, migrate_lmdb_to_rocksdb)
 | 
				
			||||||
	boost::asio::ip::address_v6 address (boost::asio::ip::make_address_v6 ("::ffff:127.0.0.1"));
 | 
						boost::asio::ip::address_v6 address (boost::asio::ip::make_address_v6 ("::ffff:127.0.0.1"));
 | 
				
			||||||
	uint16_t port = 100;
 | 
						uint16_t port = 100;
 | 
				
			||||||
	nano::lmdb::store store{ logger, path / "data.ldb", nano::dev::constants };
 | 
						nano::lmdb::store store{ logger, path / "data.ldb", nano::dev::constants };
 | 
				
			||||||
	nano::unchecked_map unchecked{ store, system.stats, false };
 | 
						nano::unchecked_map unchecked{ system.stats, false };
 | 
				
			||||||
	nano::ledger ledger{ store, system.stats, nano::dev::constants };
 | 
						nano::ledger ledger{ store, system.stats, nano::dev::constants };
 | 
				
			||||||
	nano::work_pool pool{ nano::dev::network_params.network, std::numeric_limits<unsigned>::max () };
 | 
						nano::work_pool pool{ nano::dev::network_params.network, std::numeric_limits<unsigned>::max () };
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -5582,7 +5582,7 @@ TEST (ledger, migrate_lmdb_to_rocksdb)
 | 
				
			||||||
	ASSERT_FALSE (error);
 | 
						ASSERT_FALSE (error);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	nano::rocksdb::store rocksdb_store{ logger, path / "rocksdb", nano::dev::constants };
 | 
						nano::rocksdb::store rocksdb_store{ logger, path / "rocksdb", nano::dev::constants };
 | 
				
			||||||
	nano::unchecked_map rocksdb_unchecked{ rocksdb_store, system.stats, false };
 | 
						nano::unchecked_map rocksdb_unchecked{ system.stats, false };
 | 
				
			||||||
	auto rocksdb_transaction (rocksdb_store.tx_begin_read ());
 | 
						auto rocksdb_transaction (rocksdb_store.tx_begin_read ());
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	nano::pending_info pending_info{};
 | 
						nano::pending_info pending_info{};
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -2,7 +2,7 @@
 | 
				
			||||||
#include <nano/lib/logger_mt.hpp>
 | 
					#include <nano/lib/logger_mt.hpp>
 | 
				
			||||||
#include <nano/lib/stats.hpp>
 | 
					#include <nano/lib/stats.hpp>
 | 
				
			||||||
#include <nano/node/unchecked_map.hpp>
 | 
					#include <nano/node/unchecked_map.hpp>
 | 
				
			||||||
#include <nano/secure/store.hpp>
 | 
					#include <nano/secure/common.hpp>
 | 
				
			||||||
#include <nano/secure/utility.hpp>
 | 
					#include <nano/secure/utility.hpp>
 | 
				
			||||||
#include <nano/test_common/system.hpp>
 | 
					#include <nano/test_common/system.hpp>
 | 
				
			||||||
#include <nano/test_common/testutil.hpp>
 | 
					#include <nano/test_common/testutil.hpp>
 | 
				
			||||||
| 
						 | 
					@ -19,13 +19,10 @@ class context
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
public:
 | 
					public:
 | 
				
			||||||
	context () :
 | 
						context () :
 | 
				
			||||||
		store{ nano::make_store (logger, nano::unique_path (), nano::dev::constants) },
 | 
							unchecked{ stats, false }
 | 
				
			||||||
		unchecked{ *store, stats, false }
 | 
					 | 
				
			||||||
	{
 | 
						{
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	nano::logger_mt logger;
 | 
					 | 
				
			||||||
	nano::stats stats;
 | 
						nano::stats stats;
 | 
				
			||||||
	std::unique_ptr<nano::store> store;
 | 
					 | 
				
			||||||
	nano::unchecked_map unchecked;
 | 
						nano::unchecked_map unchecked;
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
std::shared_ptr<nano::block> block ()
 | 
					std::shared_ptr<nano::block> block ()
 | 
				
			||||||
| 
						 | 
					@ -58,10 +55,7 @@ TEST (unchecked_map, put_one)
 | 
				
			||||||
TEST (block_store, one_bootstrap)
 | 
					TEST (block_store, one_bootstrap)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	nano::test::system system{};
 | 
						nano::test::system system{};
 | 
				
			||||||
	nano::logger_mt logger{};
 | 
						nano::unchecked_map unchecked{ system.stats, false };
 | 
				
			||||||
	auto store = nano::make_store (logger, nano::unique_path (), nano::dev::constants);
 | 
					 | 
				
			||||||
	nano::unchecked_map unchecked{ *store, system.stats, false };
 | 
					 | 
				
			||||||
	ASSERT_TRUE (!store->init_error ());
 | 
					 | 
				
			||||||
	nano::block_builder builder;
 | 
						nano::block_builder builder;
 | 
				
			||||||
	auto block1 = builder
 | 
						auto block1 = builder
 | 
				
			||||||
				  .send ()
 | 
									  .send ()
 | 
				
			||||||
| 
						 | 
					@ -72,12 +66,11 @@ TEST (block_store, one_bootstrap)
 | 
				
			||||||
				  .work (5)
 | 
									  .work (5)
 | 
				
			||||||
				  .build_shared ();
 | 
									  .build_shared ();
 | 
				
			||||||
	unchecked.put (block1->hash (), nano::unchecked_info{ block1 });
 | 
						unchecked.put (block1->hash (), nano::unchecked_info{ block1 });
 | 
				
			||||||
	auto check_block_is_listed = [&] (nano::transaction const & transaction_a, nano::block_hash const & block_hash_a) {
 | 
						auto check_block_is_listed = [&] (nano::block_hash const & block_hash_a) {
 | 
				
			||||||
		return unchecked.get (block_hash_a).size () > 0;
 | 
							return unchecked.get (block_hash_a).size () > 0;
 | 
				
			||||||
	};
 | 
						};
 | 
				
			||||||
	// Waits for the block1 to get saved in the database
 | 
						// Waits for the block1 to get saved in the database
 | 
				
			||||||
	ASSERT_TIMELY (10s, check_block_is_listed (store->tx_begin_read (), block1->hash ()));
 | 
						ASSERT_TIMELY (10s, check_block_is_listed (block1->hash ()));
 | 
				
			||||||
	auto transaction = store->tx_begin_read ();
 | 
					 | 
				
			||||||
	std::vector<nano::block_hash> dependencies;
 | 
						std::vector<nano::block_hash> dependencies;
 | 
				
			||||||
	unchecked.for_each ([&dependencies] (nano::unchecked_key const & key, nano::unchecked_info const & info) {
 | 
						unchecked.for_each ([&dependencies] (nano::unchecked_key const & key, nano::unchecked_info const & info) {
 | 
				
			||||||
		dependencies.push_back (key.key ());
 | 
							dependencies.push_back (key.key ());
 | 
				
			||||||
| 
						 | 
					@ -95,10 +88,7 @@ TEST (block_store, one_bootstrap)
 | 
				
			||||||
TEST (unchecked, simple)
 | 
					TEST (unchecked, simple)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	nano::test::system system{};
 | 
						nano::test::system system{};
 | 
				
			||||||
	nano::logger_mt logger{};
 | 
						nano::unchecked_map unchecked{ system.stats, false };
 | 
				
			||||||
	auto store = nano::make_store (logger, nano::unique_path (), nano::dev::constants);
 | 
					 | 
				
			||||||
	nano::unchecked_map unchecked{ *store, system.stats, false };
 | 
					 | 
				
			||||||
	ASSERT_TRUE (!store->init_error ());
 | 
					 | 
				
			||||||
	nano::block_builder builder;
 | 
						nano::block_builder builder;
 | 
				
			||||||
	auto block = builder
 | 
						auto block = builder
 | 
				
			||||||
				 .send ()
 | 
									 .send ()
 | 
				
			||||||
| 
						 | 
					@ -139,10 +129,7 @@ TEST (unchecked, multiple)
 | 
				
			||||||
		// Don't test this in rocksdb mode
 | 
							// Don't test this in rocksdb mode
 | 
				
			||||||
		GTEST_SKIP ();
 | 
							GTEST_SKIP ();
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	nano::logger_mt logger{};
 | 
						nano::unchecked_map unchecked{ system.stats, false };
 | 
				
			||||||
	auto store = nano::make_store (logger, nano::unique_path (), nano::dev::constants);
 | 
					 | 
				
			||||||
	nano::unchecked_map unchecked{ *store, system.stats, false };
 | 
					 | 
				
			||||||
	ASSERT_TRUE (!store->init_error ());
 | 
					 | 
				
			||||||
	nano::block_builder builder;
 | 
						nano::block_builder builder;
 | 
				
			||||||
	auto block = builder
 | 
						auto block = builder
 | 
				
			||||||
				 .send ()
 | 
									 .send ()
 | 
				
			||||||
| 
						 | 
					@ -172,10 +159,7 @@ TEST (unchecked, multiple)
 | 
				
			||||||
TEST (unchecked, double_put)
 | 
					TEST (unchecked, double_put)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	nano::test::system system{};
 | 
						nano::test::system system{};
 | 
				
			||||||
	nano::logger_mt logger{};
 | 
						nano::unchecked_map unchecked{ system.stats, false };
 | 
				
			||||||
	auto store = nano::make_store (logger, nano::unique_path (), nano::dev::constants);
 | 
					 | 
				
			||||||
	nano::unchecked_map unchecked{ *store, system.stats, false };
 | 
					 | 
				
			||||||
	ASSERT_TRUE (!store->init_error ());
 | 
					 | 
				
			||||||
	nano::block_builder builder;
 | 
						nano::block_builder builder;
 | 
				
			||||||
	auto block = builder
 | 
						auto block = builder
 | 
				
			||||||
				 .send ()
 | 
									 .send ()
 | 
				
			||||||
| 
						 | 
					@ -206,10 +190,7 @@ TEST (unchecked, double_put)
 | 
				
			||||||
TEST (unchecked, multiple_get)
 | 
					TEST (unchecked, multiple_get)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	nano::test::system system{};
 | 
						nano::test::system system{};
 | 
				
			||||||
	nano::logger_mt logger{};
 | 
						nano::unchecked_map unchecked{ system.stats, false };
 | 
				
			||||||
	auto store = nano::make_store (logger, nano::unique_path (), nano::dev::constants);
 | 
					 | 
				
			||||||
	nano::unchecked_map unchecked{ *store, system.stats, false };
 | 
					 | 
				
			||||||
	ASSERT_TRUE (!store->init_error ());
 | 
					 | 
				
			||||||
	// Instantiates three blocks
 | 
						// Instantiates three blocks
 | 
				
			||||||
	nano::block_builder builder;
 | 
						nano::block_builder builder;
 | 
				
			||||||
	auto block1 = builder
 | 
						auto block1 = builder
 | 
				
			||||||
| 
						 | 
					@ -248,7 +229,7 @@ TEST (unchecked, multiple_get)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	// count the number of blocks in the unchecked table by counting them one by one
 | 
						// count the number of blocks in the unchecked table by counting them one by one
 | 
				
			||||||
	// we cannot trust the count() method if the backend is rocksdb
 | 
						// we cannot trust the count() method if the backend is rocksdb
 | 
				
			||||||
	auto count_unchecked_blocks_one_by_one = [&store, &unchecked] () {
 | 
						auto count_unchecked_blocks_one_by_one = [&unchecked] () {
 | 
				
			||||||
		size_t count = 0;
 | 
							size_t count = 0;
 | 
				
			||||||
		unchecked.for_each ([&count] (nano::unchecked_key const & key, nano::unchecked_info const & info) {
 | 
							unchecked.for_each ([&count] (nano::unchecked_key const & key, nano::unchecked_info const & info) {
 | 
				
			||||||
			++count;
 | 
								++count;
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -137,7 +137,6 @@ add_library(
 | 
				
			||||||
  lmdb/version_store.hpp
 | 
					  lmdb/version_store.hpp
 | 
				
			||||||
  lmdb/version_store.cpp
 | 
					  lmdb/version_store.cpp
 | 
				
			||||||
  lmdb/unchecked_store.hpp
 | 
					  lmdb/unchecked_store.hpp
 | 
				
			||||||
  lmdb/unchecked_store.cpp
 | 
					 | 
				
			||||||
  lmdb/lmdb.hpp
 | 
					  lmdb/lmdb.hpp
 | 
				
			||||||
  lmdb/lmdb.cpp
 | 
					  lmdb/lmdb.cpp
 | 
				
			||||||
  lmdb/lmdb_env.hpp
 | 
					  lmdb/lmdb_env.hpp
 | 
				
			||||||
| 
						 | 
					@ -197,8 +196,6 @@ add_library(
 | 
				
			||||||
  rocksdb/pending_store.cpp
 | 
					  rocksdb/pending_store.cpp
 | 
				
			||||||
  rocksdb/pruned_store.hpp
 | 
					  rocksdb/pruned_store.hpp
 | 
				
			||||||
  rocksdb/pruned_store.cpp
 | 
					  rocksdb/pruned_store.cpp
 | 
				
			||||||
  rocksdb/unchecked_store.hpp
 | 
					 | 
				
			||||||
  rocksdb/unchecked_store.cpp
 | 
					 | 
				
			||||||
  rocksdb/version_store.hpp
 | 
					  rocksdb/version_store.hpp
 | 
				
			||||||
  rocksdb/version_store.cpp
 | 
					  rocksdb/version_store.cpp
 | 
				
			||||||
  rocksdb/rocksdb.hpp
 | 
					  rocksdb/rocksdb.hpp
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -222,7 +222,7 @@ auto nano::block_processor::process_batch (nano::unique_lock<nano::mutex> & lock
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	std::deque<processed_t> processed;
 | 
						std::deque<processed_t> processed;
 | 
				
			||||||
	auto scoped_write_guard = write_database_queue.wait (nano::writer::process_batch);
 | 
						auto scoped_write_guard = write_database_queue.wait (nano::writer::process_batch);
 | 
				
			||||||
	auto transaction (node.store.tx_begin_write ({ tables::accounts, tables::blocks, tables::frontiers, tables::pending, tables::unchecked }));
 | 
						auto transaction (node.store.tx_begin_write ({ tables::accounts, tables::blocks, tables::frontiers, tables::pending }));
 | 
				
			||||||
	nano::timer<std::chrono::milliseconds> timer_l;
 | 
						nano::timer<std::chrono::milliseconds> timer_l;
 | 
				
			||||||
	lock_a.lock ();
 | 
						lock_a.lock ();
 | 
				
			||||||
	timer_l.start ();
 | 
						timer_l.start ();
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -4114,7 +4114,6 @@ void nano::json_handler::unchecked ()
 | 
				
			||||||
	if (!ec)
 | 
						if (!ec)
 | 
				
			||||||
	{
 | 
						{
 | 
				
			||||||
		boost::property_tree::ptree unchecked;
 | 
							boost::property_tree::ptree unchecked;
 | 
				
			||||||
		auto transaction (node.store.tx_begin_read ());
 | 
					 | 
				
			||||||
		node.unchecked.for_each (
 | 
							node.unchecked.for_each (
 | 
				
			||||||
		[&unchecked, &json_block_l] (nano::unchecked_key const & key, nano::unchecked_info const & info) {
 | 
							[&unchecked, &json_block_l] (nano::unchecked_key const & key, nano::unchecked_info const & info) {
 | 
				
			||||||
			if (json_block_l)
 | 
								if (json_block_l)
 | 
				
			||||||
| 
						 | 
					@ -4137,7 +4136,6 @@ void nano::json_handler::unchecked ()
 | 
				
			||||||
void nano::json_handler::unchecked_clear ()
 | 
					void nano::json_handler::unchecked_clear ()
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	node.workers.push_task (create_worker_task ([] (std::shared_ptr<nano::json_handler> const & rpc_l) {
 | 
						node.workers.push_task (create_worker_task ([] (std::shared_ptr<nano::json_handler> const & rpc_l) {
 | 
				
			||||||
		auto transaction (rpc_l->node.store.tx_begin_write ({ tables::unchecked }));
 | 
					 | 
				
			||||||
		rpc_l->node.unchecked.clear ();
 | 
							rpc_l->node.unchecked.clear ();
 | 
				
			||||||
		rpc_l->response_l.put ("success", "");
 | 
							rpc_l->response_l.put ("success", "");
 | 
				
			||||||
		rpc_l->response_errors ();
 | 
							rpc_l->response_errors ();
 | 
				
			||||||
| 
						 | 
					@ -4195,7 +4193,6 @@ void nano::json_handler::unchecked_keys ()
 | 
				
			||||||
	if (!ec)
 | 
						if (!ec)
 | 
				
			||||||
	{
 | 
						{
 | 
				
			||||||
		boost::property_tree::ptree unchecked;
 | 
							boost::property_tree::ptree unchecked;
 | 
				
			||||||
		auto transaction (node.store.tx_begin_read ());
 | 
					 | 
				
			||||||
		node.unchecked.for_each (
 | 
							node.unchecked.for_each (
 | 
				
			||||||
		key,
 | 
							key,
 | 
				
			||||||
		[&unchecked, json_block_l] (nano::unchecked_key const & key, nano::unchecked_info const & info) {
 | 
							[&unchecked, json_block_l] (nano::unchecked_key const & key, nano::unchecked_info const & info) {
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -45,7 +45,6 @@ nano::lmdb::store::store (nano::logger_mt & logger_a, boost::filesystem::path co
 | 
				
			||||||
		frontier_store,
 | 
							frontier_store,
 | 
				
			||||||
		account_store,
 | 
							account_store,
 | 
				
			||||||
		pending_store,
 | 
							pending_store,
 | 
				
			||||||
		unchecked_store,
 | 
					 | 
				
			||||||
		online_weight_store,
 | 
							online_weight_store,
 | 
				
			||||||
		pruned_store,
 | 
							pruned_store,
 | 
				
			||||||
		peer_store,
 | 
							peer_store,
 | 
				
			||||||
| 
						 | 
					@ -63,7 +62,7 @@ nano::lmdb::store::store (nano::logger_mt & logger_a, boost::filesystem::path co
 | 
				
			||||||
	peer_store{ *this },
 | 
						peer_store{ *this },
 | 
				
			||||||
	confirmation_height_store{ *this },
 | 
						confirmation_height_store{ *this },
 | 
				
			||||||
	final_vote_store{ *this },
 | 
						final_vote_store{ *this },
 | 
				
			||||||
	unchecked_store{ *this },
 | 
						unchecked_store{},
 | 
				
			||||||
	version_store{ *this },
 | 
						version_store{ *this },
 | 
				
			||||||
	logger (logger_a),
 | 
						logger (logger_a),
 | 
				
			||||||
	env (error, path_a, nano::mdb_env::options::make ().set_config (lmdb_config_a).set_use_no_mem_init (true)),
 | 
						env (error, path_a, nano::mdb_env::options::make ().set_config (lmdb_config_a).set_use_no_mem_init (true)),
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1,52 +0,0 @@
 | 
				
			||||||
#include <nano/node/lmdb/lmdb.hpp>
 | 
					 | 
				
			||||||
#include <nano/node/lmdb/unchecked_store.hpp>
 | 
					 | 
				
			||||||
#include <nano/secure/parallel_traversal.hpp>
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
nano::lmdb::unchecked_store::unchecked_store (nano::lmdb::store & store_a) :
 | 
					 | 
				
			||||||
	store (store_a){};
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
void nano::lmdb::unchecked_store::clear (nano::write_transaction const & transaction_a)
 | 
					 | 
				
			||||||
{
 | 
					 | 
				
			||||||
	auto status = store.drop (transaction_a, tables::unchecked);
 | 
					 | 
				
			||||||
	store.release_assert_success (status);
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
void nano::lmdb::unchecked_store::put (nano::write_transaction const & transaction_a, nano::hash_or_account const & dependency, nano::unchecked_info const & info)
 | 
					 | 
				
			||||||
{
 | 
					 | 
				
			||||||
	auto status = store.put (transaction_a, tables::unchecked, nano::unchecked_key{ dependency, info.block->hash () }, info);
 | 
					 | 
				
			||||||
	store.release_assert_success (status);
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
bool nano::lmdb::unchecked_store::exists (nano::transaction const & transaction_a, nano::unchecked_key const & key)
 | 
					 | 
				
			||||||
{
 | 
					 | 
				
			||||||
	nano::mdb_val value;
 | 
					 | 
				
			||||||
	auto status = store.get (transaction_a, tables::unchecked, key, value);
 | 
					 | 
				
			||||||
	release_assert (store.success (status) || store.not_found (status));
 | 
					 | 
				
			||||||
	return store.success (status);
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
void nano::lmdb::unchecked_store::del (nano::write_transaction const & transaction_a, nano::unchecked_key const & key_a)
 | 
					 | 
				
			||||||
{
 | 
					 | 
				
			||||||
	auto status (store.del (transaction_a, tables::unchecked, key_a));
 | 
					 | 
				
			||||||
	store.release_assert_success (status);
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
nano::store_iterator<nano::unchecked_key, nano::unchecked_info> nano::lmdb::unchecked_store::end () const
 | 
					 | 
				
			||||||
{
 | 
					 | 
				
			||||||
	return nano::store_iterator<nano::unchecked_key, nano::unchecked_info> (nullptr);
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
nano::store_iterator<nano::unchecked_key, nano::unchecked_info> nano::lmdb::unchecked_store::begin (nano::transaction const & transaction) const
 | 
					 | 
				
			||||||
{
 | 
					 | 
				
			||||||
	return store.make_iterator<nano::unchecked_key, nano::unchecked_info> (transaction, tables::unchecked);
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
nano::store_iterator<nano::unchecked_key, nano::unchecked_info> nano::lmdb::unchecked_store::lower_bound (nano::transaction const & transaction, nano::unchecked_key const & key) const
 | 
					 | 
				
			||||||
{
 | 
					 | 
				
			||||||
	return store.make_iterator<nano::unchecked_key, nano::unchecked_info> (transaction, tables::unchecked, key);
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
size_t nano::lmdb::unchecked_store::count (nano::transaction const & transaction_a)
 | 
					 | 
				
			||||||
{
 | 
					 | 
				
			||||||
	return store.count (transaction_a, tables::unchecked);
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
| 
						 | 
					@ -1,36 +1,16 @@
 | 
				
			||||||
#pragma once
 | 
					#pragma once
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#include <nano/secure/store.hpp>
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
#include <lmdb/libraries/liblmdb/lmdb.h>
 | 
					#include <lmdb/libraries/liblmdb/lmdb.h>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
namespace nano
 | 
					namespace nano::lmdb
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
namespace lmdb
 | 
					class unchecked_store
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	class store;
 | 
					public:
 | 
				
			||||||
	class unchecked_store : public nano::unchecked_store
 | 
					 | 
				
			||||||
	{
 | 
					 | 
				
			||||||
	private:
 | 
					 | 
				
			||||||
		nano::lmdb::store & store;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	public:
 | 
					 | 
				
			||||||
		unchecked_store (nano::lmdb::store & store_a);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
		void clear (nano::write_transaction const & transaction_a) override;
 | 
					 | 
				
			||||||
		void put (nano::write_transaction const & transaction_a, nano::hash_or_account const & dependency, nano::unchecked_info const & info_a) override;
 | 
					 | 
				
			||||||
		bool exists (nano::transaction const & transaction_a, nano::unchecked_key const & unchecked_key_a) override;
 | 
					 | 
				
			||||||
		void del (nano::write_transaction const & transaction_a, nano::unchecked_key const & key_a) override;
 | 
					 | 
				
			||||||
		nano::store_iterator<nano::unchecked_key, nano::unchecked_info> end () const override;
 | 
					 | 
				
			||||||
		nano::store_iterator<nano::unchecked_key, nano::unchecked_info> begin (nano::transaction const & transaction_a) const override;
 | 
					 | 
				
			||||||
		nano::store_iterator<nano::unchecked_key, nano::unchecked_info> lower_bound (nano::transaction const & transaction_a, nano::unchecked_key const & key_a) const override;
 | 
					 | 
				
			||||||
		size_t count (nano::transaction const & transaction_a) override;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	/**
 | 
						/**
 | 
				
			||||||
	 * Unchecked bootstrap blocks info.
 | 
						 * Unchecked bootstrap blocks info.
 | 
				
			||||||
	 * nano::block_hash -> nano::unchecked_info
 | 
						 * nano::block_hash -> nano::unchecked_info
 | 
				
			||||||
	 */
 | 
						 */
 | 
				
			||||||
	MDB_dbi unchecked_handle{ 0 };
 | 
						MDB_dbi unchecked_handle{ 0 };
 | 
				
			||||||
	};
 | 
					};
 | 
				
			||||||
}
 | 
					 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -159,7 +159,7 @@ nano::node::node (boost::asio::io_context & io_ctx_a, boost::filesystem::path co
 | 
				
			||||||
	logger (config_a.logging.min_time_between_log_output),
 | 
						logger (config_a.logging.min_time_between_log_output),
 | 
				
			||||||
	store_impl (nano::make_store (logger, application_path_a, network_params.ledger, flags.read_only, true, config_a.rocksdb_config, config_a.diagnostics_config.txn_tracking, config_a.block_processor_batch_max_time, config_a.lmdb_config, config_a.backup_before_upgrade)),
 | 
						store_impl (nano::make_store (logger, application_path_a, network_params.ledger, flags.read_only, true, config_a.rocksdb_config, config_a.diagnostics_config.txn_tracking, config_a.block_processor_batch_max_time, config_a.lmdb_config, config_a.backup_before_upgrade)),
 | 
				
			||||||
	store (*store_impl),
 | 
						store (*store_impl),
 | 
				
			||||||
	unchecked{ store, stats, flags.disable_block_processor_unchecked_deletion },
 | 
						unchecked{ stats, flags.disable_block_processor_unchecked_deletion },
 | 
				
			||||||
	wallets_store_impl (std::make_unique<nano::mdb_wallets_store> (application_path_a / "wallets.ldb", config_a.lmdb_config)),
 | 
						wallets_store_impl (std::make_unique<nano::mdb_wallets_store> (application_path_a / "wallets.ldb", config_a.lmdb_config)),
 | 
				
			||||||
	wallets_store (*wallets_store_impl),
 | 
						wallets_store (*wallets_store_impl),
 | 
				
			||||||
	gap_cache (*this),
 | 
						gap_cache (*this),
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -67,7 +67,6 @@ nano::rocksdb::store::store (nano::logger_mt & logger_a, boost::filesystem::path
 | 
				
			||||||
		frontier_store,
 | 
							frontier_store,
 | 
				
			||||||
		account_store,
 | 
							account_store,
 | 
				
			||||||
		pending_store,
 | 
							pending_store,
 | 
				
			||||||
		unchecked_store,
 | 
					 | 
				
			||||||
		online_weight_store,
 | 
							online_weight_store,
 | 
				
			||||||
		pruned_store,
 | 
							pruned_store,
 | 
				
			||||||
		peer_store,
 | 
							peer_store,
 | 
				
			||||||
| 
						 | 
					@ -80,7 +79,6 @@ nano::rocksdb::store::store (nano::logger_mt & logger_a, boost::filesystem::path
 | 
				
			||||||
	frontier_store{ *this },
 | 
						frontier_store{ *this },
 | 
				
			||||||
	account_store{ *this },
 | 
						account_store{ *this },
 | 
				
			||||||
	pending_store{ *this },
 | 
						pending_store{ *this },
 | 
				
			||||||
	unchecked_store{ *this },
 | 
					 | 
				
			||||||
	online_weight_store{ *this },
 | 
						online_weight_store{ *this },
 | 
				
			||||||
	pruned_store{ *this },
 | 
						pruned_store{ *this },
 | 
				
			||||||
	peer_store{ *this },
 | 
						peer_store{ *this },
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -13,7 +13,6 @@
 | 
				
			||||||
#include <nano/node/rocksdb/pending_store.hpp>
 | 
					#include <nano/node/rocksdb/pending_store.hpp>
 | 
				
			||||||
#include <nano/node/rocksdb/pruned_store.hpp>
 | 
					#include <nano/node/rocksdb/pruned_store.hpp>
 | 
				
			||||||
#include <nano/node/rocksdb/rocksdb_iterator.hpp>
 | 
					#include <nano/node/rocksdb/rocksdb_iterator.hpp>
 | 
				
			||||||
#include <nano/node/rocksdb/unchecked_store.hpp>
 | 
					 | 
				
			||||||
#include <nano/node/rocksdb/version_store.hpp>
 | 
					#include <nano/node/rocksdb/version_store.hpp>
 | 
				
			||||||
#include <nano/secure/common.hpp>
 | 
					#include <nano/secure/common.hpp>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -47,7 +46,6 @@ namespace rocksdb
 | 
				
			||||||
		nano::rocksdb::peer_store peer_store;
 | 
							nano::rocksdb::peer_store peer_store;
 | 
				
			||||||
		nano::rocksdb::pending_store pending_store;
 | 
							nano::rocksdb::pending_store pending_store;
 | 
				
			||||||
		nano::rocksdb::pruned_store pruned_store;
 | 
							nano::rocksdb::pruned_store pruned_store;
 | 
				
			||||||
		nano::rocksdb::unchecked_store unchecked_store;
 | 
					 | 
				
			||||||
		nano::rocksdb::version_store version_store;
 | 
							nano::rocksdb::version_store version_store;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	public:
 | 
						public:
 | 
				
			||||||
| 
						 | 
					@ -60,7 +58,6 @@ namespace rocksdb
 | 
				
			||||||
		friend class nano::rocksdb::peer_store;
 | 
							friend class nano::rocksdb::peer_store;
 | 
				
			||||||
		friend class nano::rocksdb::pending_store;
 | 
							friend class nano::rocksdb::pending_store;
 | 
				
			||||||
		friend class nano::rocksdb::pruned_store;
 | 
							friend class nano::rocksdb::pruned_store;
 | 
				
			||||||
		friend class nano::rocksdb::unchecked_store;
 | 
					 | 
				
			||||||
		friend class nano::rocksdb::version_store;
 | 
							friend class nano::rocksdb::version_store;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		explicit store (nano::logger_mt &, boost::filesystem::path const &, nano::ledger_constants & constants, nano::rocksdb_config const & = nano::rocksdb_config{}, bool open_read_only = false);
 | 
							explicit store (nano::logger_mt &, boost::filesystem::path const &, nano::ledger_constants & constants, nano::rocksdb_config const & = nano::rocksdb_config{}, bool open_read_only = false);
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1,52 +0,0 @@
 | 
				
			||||||
#include <nano/node/lmdb/unchecked_store.hpp>
 | 
					 | 
				
			||||||
#include <nano/node/rocksdb/rocksdb.hpp>
 | 
					 | 
				
			||||||
#include <nano/secure/parallel_traversal.hpp>
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
nano::rocksdb::unchecked_store::unchecked_store (nano::rocksdb::store & store_a) :
 | 
					 | 
				
			||||||
	store (store_a){};
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
void nano::rocksdb::unchecked_store::clear (nano::write_transaction const & transaction_a)
 | 
					 | 
				
			||||||
{
 | 
					 | 
				
			||||||
	auto status = store.drop (transaction_a, tables::unchecked);
 | 
					 | 
				
			||||||
	store.release_assert_success (status);
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
void nano::rocksdb::unchecked_store::put (nano::write_transaction const & transaction_a, nano::hash_or_account const & dependency, nano::unchecked_info const & info)
 | 
					 | 
				
			||||||
{
 | 
					 | 
				
			||||||
	auto status = store.put (transaction_a, tables::unchecked, nano::unchecked_key{ dependency, info.block->hash () }, info);
 | 
					 | 
				
			||||||
	store.release_assert_success (status);
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
bool nano::rocksdb::unchecked_store::exists (nano::transaction const & transaction_a, nano::unchecked_key const & key)
 | 
					 | 
				
			||||||
{
 | 
					 | 
				
			||||||
	nano::rocksdb_val value;
 | 
					 | 
				
			||||||
	auto status = store.get (transaction_a, tables::unchecked, key, value);
 | 
					 | 
				
			||||||
	release_assert (store.success (status) || store.not_found (status));
 | 
					 | 
				
			||||||
	return store.success (status);
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
void nano::rocksdb::unchecked_store::del (nano::write_transaction const & transaction_a, nano::unchecked_key const & key_a)
 | 
					 | 
				
			||||||
{
 | 
					 | 
				
			||||||
	auto status (store.del (transaction_a, tables::unchecked, key_a));
 | 
					 | 
				
			||||||
	store.release_assert_success (status);
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
nano::store_iterator<nano::unchecked_key, nano::unchecked_info> nano::rocksdb::unchecked_store::end () const
 | 
					 | 
				
			||||||
{
 | 
					 | 
				
			||||||
	return nano::store_iterator<nano::unchecked_key, nano::unchecked_info> (nullptr);
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
nano::store_iterator<nano::unchecked_key, nano::unchecked_info> nano::rocksdb::unchecked_store::begin (nano::transaction const & transaction) const
 | 
					 | 
				
			||||||
{
 | 
					 | 
				
			||||||
	return store.make_iterator<nano::unchecked_key, nano::unchecked_info> (transaction, tables::unchecked);
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
nano::store_iterator<nano::unchecked_key, nano::unchecked_info> nano::rocksdb::unchecked_store::lower_bound (nano::transaction const & transaction, nano::unchecked_key const & key) const
 | 
					 | 
				
			||||||
{
 | 
					 | 
				
			||||||
	return store.make_iterator<nano::unchecked_key, nano::unchecked_info> (transaction, tables::unchecked, key);
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
size_t nano::rocksdb::unchecked_store::count (nano::transaction const & transaction_a)
 | 
					 | 
				
			||||||
{
 | 
					 | 
				
			||||||
	return store.count (transaction_a, tables::unchecked);
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
| 
						 | 
					@ -1,28 +0,0 @@
 | 
				
			||||||
#pragma once
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
#include <nano/secure/store.hpp>
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
namespace nano
 | 
					 | 
				
			||||||
{
 | 
					 | 
				
			||||||
namespace rocksdb
 | 
					 | 
				
			||||||
{
 | 
					 | 
				
			||||||
	class store;
 | 
					 | 
				
			||||||
	class unchecked_store : public nano::unchecked_store
 | 
					 | 
				
			||||||
	{
 | 
					 | 
				
			||||||
	private:
 | 
					 | 
				
			||||||
		nano::rocksdb::store & store;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	public:
 | 
					 | 
				
			||||||
		unchecked_store (nano::rocksdb::store & store_a);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
		void clear (nano::write_transaction const & transaction_a) override;
 | 
					 | 
				
			||||||
		void put (nano::write_transaction const & transaction_a, nano::hash_or_account const & dependency, nano::unchecked_info const & info_a) override;
 | 
					 | 
				
			||||||
		bool exists (nano::transaction const & transaction_a, nano::unchecked_key const & unchecked_key_a) override;
 | 
					 | 
				
			||||||
		void del (nano::write_transaction const & transaction_a, nano::unchecked_key const & key_a) override;
 | 
					 | 
				
			||||||
		nano::store_iterator<nano::unchecked_key, nano::unchecked_info> end () const override;
 | 
					 | 
				
			||||||
		nano::store_iterator<nano::unchecked_key, nano::unchecked_info> begin (nano::transaction const & transaction_a) const override;
 | 
					 | 
				
			||||||
		nano::store_iterator<nano::unchecked_key, nano::unchecked_info> lower_bound (nano::transaction const & transaction_a, nano::unchecked_key const & key_a) const override;
 | 
					 | 
				
			||||||
		size_t count (nano::transaction const & transaction_a) override;
 | 
					 | 
				
			||||||
	};
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
| 
						 | 
					@ -4,10 +4,8 @@
 | 
				
			||||||
#include <nano/lib/threading.hpp>
 | 
					#include <nano/lib/threading.hpp>
 | 
				
			||||||
#include <nano/lib/timer.hpp>
 | 
					#include <nano/lib/timer.hpp>
 | 
				
			||||||
#include <nano/node/unchecked_map.hpp>
 | 
					#include <nano/node/unchecked_map.hpp>
 | 
				
			||||||
#include <nano/secure/store.hpp>
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
nano::unchecked_map::unchecked_map (nano::store & store, nano::stats & stats, bool const & disable_delete) :
 | 
					nano::unchecked_map::unchecked_map (nano::stats & stats, bool const & disable_delete) :
 | 
				
			||||||
	store{ store },
 | 
					 | 
				
			||||||
	stats{ stats },
 | 
						stats{ stats },
 | 
				
			||||||
	disable_delete{ disable_delete },
 | 
						disable_delete{ disable_delete },
 | 
				
			||||||
	thread{ [this] () { run (); } }
 | 
						thread{ [this] () { run (); } }
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -3,7 +3,7 @@
 | 
				
			||||||
#include <nano/lib/locks.hpp>
 | 
					#include <nano/lib/locks.hpp>
 | 
				
			||||||
#include <nano/lib/numbers.hpp>
 | 
					#include <nano/lib/numbers.hpp>
 | 
				
			||||||
#include <nano/lib/observer_set.hpp>
 | 
					#include <nano/lib/observer_set.hpp>
 | 
				
			||||||
#include <nano/secure/store.hpp>
 | 
					#include <nano/secure/common.hpp>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#include <boost/multi_index/member.hpp>
 | 
					#include <boost/multi_index/member.hpp>
 | 
				
			||||||
#include <boost/multi_index/ordered_index.hpp>
 | 
					#include <boost/multi_index/ordered_index.hpp>
 | 
				
			||||||
| 
						 | 
					@ -18,16 +18,11 @@ namespace mi = boost::multi_index;
 | 
				
			||||||
namespace nano
 | 
					namespace nano
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
class stats;
 | 
					class stats;
 | 
				
			||||||
class store;
 | 
					 | 
				
			||||||
class transaction;
 | 
					 | 
				
			||||||
class unchecked_info;
 | 
					 | 
				
			||||||
class unchecked_key;
 | 
					 | 
				
			||||||
class write_transaction;
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
class unchecked_map
 | 
					class unchecked_map
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
public:
 | 
					public:
 | 
				
			||||||
	unchecked_map (nano::store &, nano::stats &, bool const & do_delete);
 | 
						unchecked_map (nano::stats &, bool const & do_delete);
 | 
				
			||||||
	~unchecked_map ();
 | 
						~unchecked_map ();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	void put (nano::hash_or_account const & dependency, nano::unchecked_info const & info);
 | 
						void put (nano::hash_or_account const & dependency, nano::unchecked_info const & info);
 | 
				
			||||||
| 
						 | 
					@ -56,7 +51,6 @@ private:
 | 
				
			||||||
	void query_impl (nano::block_hash const & hash);
 | 
						void query_impl (nano::block_hash const & hash);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
private: // Dependencies
 | 
					private: // Dependencies
 | 
				
			||||||
	nano::store & store;
 | 
					 | 
				
			||||||
	nano::stats & stats;
 | 
						nano::stats & stats;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
private:
 | 
					private:
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -112,7 +112,6 @@ nano::store::store (
 | 
				
			||||||
	nano::frontier_store & frontier_store_a,
 | 
						nano::frontier_store & frontier_store_a,
 | 
				
			||||||
	nano::account_store & account_store_a,
 | 
						nano::account_store & account_store_a,
 | 
				
			||||||
	nano::pending_store & pending_store_a,
 | 
						nano::pending_store & pending_store_a,
 | 
				
			||||||
	nano::unchecked_store & unchecked_store_a,
 | 
					 | 
				
			||||||
	nano::online_weight_store & online_weight_store_a,
 | 
						nano::online_weight_store & online_weight_store_a,
 | 
				
			||||||
	nano::pruned_store & pruned_store_a,
 | 
						nano::pruned_store & pruned_store_a,
 | 
				
			||||||
	nano::peer_store & peer_store_a,
 | 
						nano::peer_store & peer_store_a,
 | 
				
			||||||
| 
						 | 
					@ -124,7 +123,6 @@ nano::store::store (
 | 
				
			||||||
	frontier (frontier_store_a),
 | 
						frontier (frontier_store_a),
 | 
				
			||||||
	account (account_store_a),
 | 
						account (account_store_a),
 | 
				
			||||||
	pending (pending_store_a),
 | 
						pending (pending_store_a),
 | 
				
			||||||
	unchecked (unchecked_store_a),
 | 
					 | 
				
			||||||
	online_weight (online_weight_store_a),
 | 
						online_weight (online_weight_store_a),
 | 
				
			||||||
	pruned (pruned_store_a),
 | 
						pruned (pruned_store_a),
 | 
				
			||||||
	peer (peer_store_a),
 | 
						peer (peer_store_a),
 | 
				
			||||||
| 
						 | 
					@ -155,20 +153,6 @@ void nano::store::initialize (nano::write_transaction const & transaction_a, nan
 | 
				
			||||||
	frontier.put (transaction_a, hash_l, constants.genesis->account ());
 | 
						frontier.put (transaction_a, hash_l, constants.genesis->account ());
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
auto nano::unchecked_store::equal_range (nano::transaction const & transaction, nano::block_hash const & dependency) -> std::pair<iterator, iterator>
 | 
					 | 
				
			||||||
{
 | 
					 | 
				
			||||||
	nano::unchecked_key begin_l{ dependency, 0 };
 | 
					 | 
				
			||||||
	nano::unchecked_key end_l{ nano::block_hash{ dependency.number () + 1 }, 0 };
 | 
					 | 
				
			||||||
	// Adjust for edge case where number () + 1 wraps around.
 | 
					 | 
				
			||||||
	auto end_iter = begin_l.previous < end_l.previous ? lower_bound (transaction, end_l) : end ();
 | 
					 | 
				
			||||||
	return std::make_pair (lower_bound (transaction, begin_l), std::move (end_iter));
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
auto nano::unchecked_store::full_range (nano::transaction const & transaction) -> std::pair<iterator, iterator>
 | 
					 | 
				
			||||||
{
 | 
					 | 
				
			||||||
	return std::make_pair (begin (transaction), end ());
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
std::optional<nano::account_info> nano::account_store::get (const nano::transaction & transaction, const nano::account & account)
 | 
					std::optional<nano::account_info> nano::account_store::get (const nano::transaction & transaction, const nano::account & account)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	nano::account_info info;
 | 
						nano::account_info info;
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -103,22 +103,6 @@ public:
 | 
				
			||||||
		static_assert (std::is_standard_layout<nano::pending_key>::value, "Standard layout is required");
 | 
							static_assert (std::is_standard_layout<nano::pending_key>::value, "Standard layout is required");
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	db_val (nano::unchecked_info const & val_a) :
 | 
					 | 
				
			||||||
		buffer (std::make_shared<std::vector<uint8_t>> ())
 | 
					 | 
				
			||||||
	{
 | 
					 | 
				
			||||||
		{
 | 
					 | 
				
			||||||
			nano::vectorstream stream (*buffer);
 | 
					 | 
				
			||||||
			val_a.serialize (stream);
 | 
					 | 
				
			||||||
		}
 | 
					 | 
				
			||||||
		convert_buffer_to_value ();
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	db_val (nano::unchecked_key const & val_a) :
 | 
					 | 
				
			||||||
		db_val (sizeof (val_a), const_cast<nano::unchecked_key *> (&val_a))
 | 
					 | 
				
			||||||
	{
 | 
					 | 
				
			||||||
		static_assert (std::is_standard_layout<nano::unchecked_key>::value, "Standard layout is required");
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	db_val (nano::confirmation_height_info const & val_a) :
 | 
						db_val (nano::confirmation_height_info const & val_a) :
 | 
				
			||||||
		buffer (std::make_shared<std::vector<uint8_t>> ())
 | 
							buffer (std::make_shared<std::vector<uint8_t>> ())
 | 
				
			||||||
	{
 | 
						{
 | 
				
			||||||
| 
						 | 
					@ -222,25 +206,6 @@ public:
 | 
				
			||||||
		return result;
 | 
							return result;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	explicit operator nano::unchecked_info () const
 | 
					 | 
				
			||||||
	{
 | 
					 | 
				
			||||||
		nano::bufferstream stream (reinterpret_cast<uint8_t const *> (data ()), size ());
 | 
					 | 
				
			||||||
		nano::unchecked_info result;
 | 
					 | 
				
			||||||
		bool error (result.deserialize (stream));
 | 
					 | 
				
			||||||
		(void)error;
 | 
					 | 
				
			||||||
		debug_assert (!error);
 | 
					 | 
				
			||||||
		return result;
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	explicit operator nano::unchecked_key () const
 | 
					 | 
				
			||||||
	{
 | 
					 | 
				
			||||||
		nano::unchecked_key result;
 | 
					 | 
				
			||||||
		debug_assert (size () == sizeof (result));
 | 
					 | 
				
			||||||
		static_assert (sizeof (nano::unchecked_key::previous) + sizeof (nano::pending_key::hash) == sizeof (result), "Packed class");
 | 
					 | 
				
			||||||
		std::copy (reinterpret_cast<uint8_t const *> (data ()), reinterpret_cast<uint8_t const *> (data ()) + sizeof (result), reinterpret_cast<uint8_t *> (&result));
 | 
					 | 
				
			||||||
		return result;
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	explicit operator nano::uint128_union () const
 | 
						explicit operator nano::uint128_union () const
 | 
				
			||||||
	{
 | 
						{
 | 
				
			||||||
		return convert<nano::uint128_union> ();
 | 
							return convert<nano::uint128_union> ();
 | 
				
			||||||
| 
						 | 
					@ -745,26 +710,6 @@ public:
 | 
				
			||||||
	virtual void for_each_par (std::function<void (nano::read_transaction const &, nano::store_iterator<nano::account, nano::confirmation_height_info>, nano::store_iterator<nano::account, nano::confirmation_height_info>)> const &) const = 0;
 | 
						virtual void for_each_par (std::function<void (nano::read_transaction const &, nano::store_iterator<nano::account, nano::confirmation_height_info>, nano::store_iterator<nano::account, nano::confirmation_height_info>)> const &) const = 0;
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					 | 
				
			||||||
 * Manages unchecked storage and iteration
 | 
					 | 
				
			||||||
 */
 | 
					 | 
				
			||||||
class unchecked_store
 | 
					 | 
				
			||||||
{
 | 
					 | 
				
			||||||
public:
 | 
					 | 
				
			||||||
	using iterator = nano::store_iterator<nano::unchecked_key, nano::unchecked_info>;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	virtual void clear (nano::write_transaction const &) = 0;
 | 
					 | 
				
			||||||
	virtual void put (nano::write_transaction const &, nano::hash_or_account const & dependency, nano::unchecked_info const &) = 0;
 | 
					 | 
				
			||||||
	std::pair<iterator, iterator> equal_range (nano::transaction const & transaction, nano::block_hash const & dependency);
 | 
					 | 
				
			||||||
	std::pair<iterator, iterator> full_range (nano::transaction const & transaction);
 | 
					 | 
				
			||||||
	virtual bool exists (nano::transaction const & transaction_a, nano::unchecked_key const & unchecked_key_a) = 0;
 | 
					 | 
				
			||||||
	virtual void del (nano::write_transaction const &, nano::unchecked_key const &) = 0;
 | 
					 | 
				
			||||||
	virtual iterator begin (nano::transaction const &) const = 0;
 | 
					 | 
				
			||||||
	virtual iterator lower_bound (nano::transaction const &, nano::unchecked_key const &) const = 0;
 | 
					 | 
				
			||||||
	virtual iterator end () const = 0;
 | 
					 | 
				
			||||||
	virtual size_t count (nano::transaction const &) = 0;
 | 
					 | 
				
			||||||
};
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
/**
 | 
					/**
 | 
				
			||||||
 * Manages final vote storage and iteration
 | 
					 * Manages final vote storage and iteration
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
| 
						 | 
					@ -821,7 +766,6 @@ public:
 | 
				
			||||||
	virtual uint64_t account_height (nano::transaction const & transaction_a, nano::block_hash const & hash_a) const = 0;
 | 
						virtual uint64_t account_height (nano::transaction const & transaction_a, nano::block_hash const & hash_a) const = 0;
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
class unchecked_map;
 | 
					 | 
				
			||||||
/**
 | 
					/**
 | 
				
			||||||
 * Store manager
 | 
					 * Store manager
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
| 
						 | 
					@ -836,7 +780,6 @@ public:
 | 
				
			||||||
		nano::frontier_store &,
 | 
							nano::frontier_store &,
 | 
				
			||||||
		nano::account_store &,
 | 
							nano::account_store &,
 | 
				
			||||||
		nano::pending_store &,
 | 
							nano::pending_store &,
 | 
				
			||||||
		nano::unchecked_store &,
 | 
					 | 
				
			||||||
		nano::online_weight_store &,
 | 
							nano::online_weight_store &,
 | 
				
			||||||
		nano::pruned_store &,
 | 
							nano::pruned_store &,
 | 
				
			||||||
		nano::peer_store &,
 | 
							nano::peer_store &,
 | 
				
			||||||
| 
						 | 
					@ -861,9 +804,6 @@ public:
 | 
				
			||||||
	static int constexpr version_minimum{ 14 };
 | 
						static int constexpr version_minimum{ 14 };
 | 
				
			||||||
	static int constexpr version_current{ 21 };
 | 
						static int constexpr version_current{ 21 };
 | 
				
			||||||
 | 
					
 | 
				
			||||||
private:
 | 
					 | 
				
			||||||
	unchecked_store & unchecked;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
public:
 | 
					public:
 | 
				
			||||||
	online_weight_store & online_weight;
 | 
						online_weight_store & online_weight;
 | 
				
			||||||
	pruned_store & pruned;
 | 
						pruned_store & pruned;
 | 
				
			||||||
| 
						 | 
					@ -890,8 +830,6 @@ public:
 | 
				
			||||||
	virtual nano::read_transaction tx_begin_read () const = 0;
 | 
						virtual nano::read_transaction tx_begin_read () const = 0;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	virtual std::string vendor_get () const = 0;
 | 
						virtual std::string vendor_get () const = 0;
 | 
				
			||||||
 | 
					 | 
				
			||||||
	friend class unchecked_map;
 | 
					 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
std::unique_ptr<nano::store> make_store (nano::logger_mt & logger, boost::filesystem::path const & path, nano::ledger_constants & constants, bool open_read_only = false, bool add_db_postfix = false, nano::rocksdb_config const & rocksdb_config = nano::rocksdb_config{}, nano::txn_tracking_config const & txn_tracking_config_a = nano::txn_tracking_config{}, std::chrono::milliseconds block_processor_batch_max_time_a = std::chrono::milliseconds (5000), nano::lmdb_config const & lmdb_config_a = nano::lmdb_config{}, bool backup_before_upgrade = false);
 | 
					std::unique_ptr<nano::store> make_store (nano::logger_mt & logger, boost::filesystem::path const & path, nano::ledger_constants & constants, bool open_read_only = false, bool add_db_postfix = false, nano::rocksdb_config const & rocksdb_config = nano::rocksdb_config{}, nano::txn_tracking_config const & txn_tracking_config_a = nano::txn_tracking_config{}, std::chrono::milliseconds block_processor_batch_max_time_a = std::chrono::milliseconds (5000), nano::lmdb_config const & lmdb_config_a = nano::lmdb_config{}, bool backup_before_upgrade = false);
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue