Merge pull request #4468 from clemahieu/block_ledger_header_reduction

Blocks.hpp recompile time reduction
This commit is contained in:
clemahieu 2024-03-07 13:10:29 +00:00 committed by GitHub
commit 8c9e97f41a
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
109 changed files with 315 additions and 145 deletions

View file

@ -1,3 +1,4 @@
#include <nano/lib/blocks.hpp>
#include <nano/lib/jsonconfig.hpp>
#include <nano/node/election.hpp>
#include <nano/node/scheduler/component.hpp>

View file

@ -1,3 +1,4 @@
#include <nano/lib/blocks.hpp>
#include <nano/node/active_transactions.hpp>
#include <nano/test_common/chains.hpp>
#include <nano/test_common/system.hpp>

View file

@ -1,3 +1,4 @@
#include <nano/lib/blocks.hpp>
#include <nano/lib/stream.hpp>
#include <nano/node/common.hpp>
#include <nano/test_common/testutil.hpp>

View file

@ -1,4 +1,5 @@
#include <nano/crypto_lib/random_pool.hpp>
#include <nano/lib/blocks.hpp>
#include <nano/lib/lmdbconfig.hpp>
#include <nano/lib/logging.hpp>
#include <nano/lib/stats.hpp>

View file

@ -1,4 +1,5 @@
#include <nano/lib/blockbuilders.hpp>
#include <nano/lib/blocks.hpp>
#include <nano/node/node.hpp>
#include <nano/node/nodeconfig.hpp>
#include <nano/secure/common.hpp>

View file

@ -1,3 +1,4 @@
#include <nano/lib/blocks.hpp>
#include <nano/node/bootstrap/block_deserializer.hpp>
#include <nano/node/bootstrap/bootstrap_frontier.hpp>
#include <nano/node/bootstrap/bootstrap_lazy.hpp>

View file

@ -1,3 +1,4 @@
#include <nano/lib/blocks.hpp>
#include <nano/lib/logging.hpp>
#include <nano/lib/stats.hpp>
#include <nano/lib/tomlconfig.hpp>

View file

@ -1,3 +1,4 @@
#include <nano/lib/blocks.hpp>
#include <nano/test_common/chains.hpp>
#include <nano/test_common/system.hpp>
#include <nano/test_common/testutil.hpp>

View file

@ -1,3 +1,4 @@
#include <nano/lib/blocks.hpp>
#include <nano/lib/logging.hpp>
#include <nano/node/election.hpp>
#include <nano/node/make_store.hpp>

View file

@ -1,3 +1,4 @@
#include <nano/lib/blocks.hpp>
#include <nano/lib/jsonconfig.hpp>
#include <nano/node/confirmation_solicitor.hpp>
#include <nano/node/transport/inproc.hpp>

View file

@ -1,4 +1,4 @@
#include <nano/lib/blocks.hpp>
#include <nano/node/election.hpp>
#include <nano/node/scheduler/component.hpp>
#include <nano/node/scheduler/priority.hpp>

View file

@ -1,3 +1,4 @@
#include <nano/lib/blocks.hpp>
#include <nano/node/election.hpp>
#include <nano/node/scheduler/component.hpp>
#include <nano/node/scheduler/priority.hpp>

View file

@ -1,3 +1,4 @@
#include <nano/lib/blocks.hpp>
#include <nano/node/scheduler/component.hpp>
#include <nano/node/scheduler/priority.hpp>
#include <nano/test_common/system.hpp>

View file

@ -1,3 +1,4 @@
#include <nano/lib/blocks.hpp>
#include <nano/node/active_transactions.hpp>
#include <nano/test_common/system.hpp>
#include <nano/test_common/testutil.hpp>

View file

@ -1,3 +1,4 @@
#include <nano/lib/blocks.hpp>
#include <nano/lib/logging.hpp>
#include <nano/lib/stats.hpp>
#include <nano/lib/threading.hpp>

View file

@ -1,3 +1,4 @@
#include <nano/lib/blocks.hpp>
#include <nano/lib/memory.hpp>
#include <nano/node/active_transactions.hpp>
#include <nano/secure/common.hpp>

View file

@ -1,4 +1,5 @@
#include <nano/crypto_lib/random_pool.hpp>
#include <nano/lib/blocks.hpp>
#include <nano/lib/stream.hpp>
#include <nano/node/common.hpp>
#include <nano/node/network.hpp>

View file

@ -1,3 +1,4 @@
#include <nano/lib/blocks.hpp>
#include <nano/node/transport/message_deserializer.hpp>
#include <nano/test_common/system.hpp>
#include <nano/test_common/testutil.hpp>

View file

@ -1,3 +1,4 @@
#include <nano/lib/blocks.hpp>
#include <nano/node/network.hpp>
#include <nano/node/nodeconfig.hpp>
#include <nano/node/scheduler/component.hpp>

View file

@ -1,3 +1,4 @@
#include <nano/lib/blocks.hpp>
#include <nano/lib/stream.hpp>
#include <nano/node/common.hpp>
#include <nano/secure/common.hpp>

View file

@ -1,3 +1,4 @@
#include <nano/lib/blocks.hpp>
#include <nano/lib/config.hpp>
#include <nano/lib/logging.hpp>
#include <nano/node/election.hpp>

View file

@ -1,3 +1,4 @@
#include <nano/lib/blocks.hpp>
#include <nano/node/election.hpp>
#include <nano/test_common/chains.hpp>
#include <nano/test_common/system.hpp>

View file

@ -1,3 +1,4 @@
#include <nano/lib/blocks.hpp>
#include <nano/lib/logging.hpp>
#include <nano/lib/stats.hpp>
#include <nano/lib/work.hpp>

View file

@ -1,3 +1,4 @@
#include <nano/lib/blocks.hpp>
#include <nano/lib/jsonconfig.hpp>
#include <nano/node/request_aggregator.hpp>
#include <nano/node/transport/inproc.hpp>

View file

@ -1,3 +1,4 @@
#include <nano/lib/blocks.hpp>
#include <nano/node/scheduler/buckets.hpp>
#include <nano/secure/common.hpp>

View file

@ -1,3 +1,4 @@
#include <nano/lib/blocks.hpp>
#include <nano/lib/thread_runner.hpp>
#include <nano/node/transport/inproc.hpp>
#include <nano/test_common/network.hpp>

View file

@ -1,4 +1,5 @@
#include <nano/lib/blockbuilders.hpp>
#include <nano/lib/blocks.hpp>
#include <nano/lib/stats.hpp>
#include <nano/node/unchecked_map.hpp>
#include <nano/secure/common.hpp>

View file

@ -1,3 +1,4 @@
#include <nano/lib/blocks.hpp>
#include <nano/lib/jsonconfig.hpp>
#include <nano/node/transport/inproc.hpp>
#include <nano/node/vote_processor.hpp>

View file

@ -1,3 +1,4 @@
#include <nano/lib/blocks.hpp>
#include <nano/node/common.hpp>
#include <nano/node/voting.hpp>
#include <nano/test_common/system.hpp>

View file

@ -1,4 +1,5 @@
#include <nano/crypto_lib/random_pool.hpp>
#include <nano/lib/blocks.hpp>
#include <nano/lib/thread_runner.hpp>
#include <nano/store/lmdb/wallet_value.hpp>
#include <nano/test_common/system.hpp>

View file

@ -1,3 +1,4 @@
#include <nano/lib/blocks.hpp>
#include <nano/store/versioning.hpp>
#include <nano/test_common/system.hpp>
#include <nano/test_common/testutil.hpp>

View file

@ -1,4 +1,5 @@
#include <nano/core_test/fakes/websocket_client.hpp>
#include <nano/lib/blocks.hpp>
#include <nano/node/transport/fake.hpp>
#include <nano/node/websocket.hpp>
#include <nano/test_common/network.hpp>

View file

@ -21,6 +21,11 @@ add_library(
${platform_sources}
asio.hpp
asio.cpp
block_sideband.hpp
block_sideband.cpp
block_type.hpp
block_type.cpp
block_uniquer.hpp
blockbuilders.hpp
blockbuilders.cpp
blocks.hpp

View file

View file

@ -0,0 +1,69 @@
#pragma once
#include <nano/lib/block_type.hpp>
#include <nano/lib/epoch.hpp>
#include <nano/lib/numbers.hpp>
#include <nano/lib/stream.hpp>
#include <nano/lib/timer.hpp>
#include <cstdint>
#include <memory>
namespace nano
{
class object_stream;
}
namespace nano
{
class block_details
{
static_assert (std::is_same<std::underlying_type<nano::epoch>::type, uint8_t> (), "Epoch enum is not the proper type");
static_assert (static_cast<uint8_t> (nano::epoch::max) < (1 << 5), "Epoch max is too large for the sideband");
public:
block_details () = default;
block_details (nano::epoch const epoch_a, bool const is_send_a, bool const is_receive_a, bool const is_epoch_a);
static constexpr size_t size ()
{
return 1;
}
bool operator== (block_details const & other_a) const;
void serialize (nano::stream &) const;
bool deserialize (nano::stream &);
nano::epoch epoch{ nano::epoch::epoch_0 };
bool is_send{ false };
bool is_receive{ false };
bool is_epoch{ false };
private:
uint8_t packed () const;
void unpack (uint8_t);
public: // Logging
void operator() (nano::object_stream &) const;
};
std::string state_subtype (nano::block_details const);
class block_sideband final
{
public:
block_sideband () = default;
block_sideband (nano::account const &, nano::block_hash const &, nano::amount const &, uint64_t const, nano::seconds_t const local_timestamp, nano::block_details const &, nano::epoch const source_epoch_a);
block_sideband (nano::account const &, nano::block_hash const &, nano::amount const &, uint64_t const, nano::seconds_t const local_timestamp, nano::epoch const epoch_a, bool const is_send, bool const is_receive, bool const is_epoch, nano::epoch const source_epoch_a);
void serialize (nano::stream &, nano::block_type) const;
bool deserialize (nano::stream &, nano::block_type);
static size_t size (nano::block_type);
nano::block_hash successor{ 0 };
nano::account account{};
nano::amount balance{ 0 };
uint64_t height{ 0 };
uint64_t timestamp{ 0 };
nano::block_details details;
nano::epoch source_epoch{ nano::epoch::epoch_0 };
public: // Logging
void operator() (nano::object_stream &) const;
};
} // namespace nano

13
nano/lib/block_type.cpp Normal file
View file

@ -0,0 +1,13 @@
#include <nano/lib/block_type.hpp>
#include <magic_enum.hpp>
std::string_view nano::to_string (nano::block_type type)
{
return magic_enum::enum_name (type);
}
void nano::serialize_block_type (nano::stream & stream, const nano::block_type & type)
{
nano::write (stream, type);
}

26
nano/lib/block_type.hpp Normal file
View file

@ -0,0 +1,26 @@
#pragma once
#include <nano/lib/stream.hpp>
#include <cstdint>
#include <string>
namespace nano
{
enum class block_type : uint8_t
{
invalid = 0,
not_a_block = 1,
send = 2,
receive = 3,
open = 4,
change = 5,
state = 6
};
std::string_view to_string (block_type);
/**
* Serialize block type as an 8-bit value
*/
void serialize_block_type (nano::stream &, nano::block_type const &);
} // namespace nano

View file

@ -0,0 +1,10 @@
#pragma once
#include <nano/lib/numbers.hpp>
#include <nano/lib/uniquer.hpp>
namespace nano
{
class block;
using block_uniquer = nano::uniquer<nano::uint256_union, nano::block>;
}

View file

@ -1,4 +1,7 @@
#include <nano/lib/blockbuilders.hpp>
#include <nano/lib/blocks.hpp>
#include <nano/lib/errors.hpp>
#include <nano/lib/utility.hpp>
#include <unordered_map>

View file

@ -1,9 +1,18 @@
#pragma once
#include <nano/lib/blocks.hpp>
#include <nano/lib/numbers.hpp>
#include <memory>
namespace nano
{
class change_block;
class send_block;
class state_block;
class open_block;
class receive_block;
}
namespace nano
{
/** Flags to track builder state */

View file

@ -13,6 +13,12 @@
#include <cryptopp/words.h>
#include <magic_enum.hpp>
size_t constexpr nano::send_block::size;
size_t constexpr nano::receive_block::size;
size_t constexpr nano::open_block::size;
size_t constexpr nano::change_block::size;
size_t constexpr nano::state_block::size;
/** Compare blocks, first by type, then content. This is an optimization over dynamic_cast, which is very slow on some platforms. */
namespace
{
@ -1443,11 +1449,6 @@ std::shared_ptr<nano::block> nano::deserialize_block_json (boost::property_tree:
return result;
}
void nano::serialize_block_type (nano::stream & stream, const nano::block_type & type)
{
nano::write (stream, type);
}
void nano::serialize_block (nano::stream & stream_a, nano::block const & block_a)
{
nano::serialize_block_type (stream_a, block_a.type ());
@ -1986,8 +1987,3 @@ void nano::block_sideband::operator() (nano::object_stream & obs) const
obs.write ("source_epoch", source_epoch);
obs.write ("details", details);
}
std::string_view nano::to_string (nano::block_type type)
{
return magic_enum::enum_name (type);
}

View file

@ -1,89 +1,23 @@
#pragma once
#include <nano/crypto/blake2/blake2.h>
#include <nano/lib/block_sideband.hpp>
#include <nano/lib/block_uniquer.hpp>
#include <nano/lib/config.hpp>
#include <nano/lib/epoch.hpp>
#include <nano/lib/errors.hpp>
#include <nano/lib/numbers.hpp>
#include <nano/lib/object_stream.hpp>
#include <nano/lib/optional_ptr.hpp>
#include <nano/lib/stream.hpp>
#include <nano/lib/timer.hpp>
#include <nano/lib/uniquer.hpp>
#include <nano/lib/utility.hpp>
#include <nano/lib/work.hpp>
#include <boost/property_tree/ptree_fwd.hpp>
#include <unordered_map>
typedef struct blake2b_state__ blake2b_state;
namespace nano
{
class block_visitor;
class mutable_block_visitor;
enum class block_type : uint8_t
{
invalid = 0,
not_a_block = 1,
send = 2,
receive = 3,
open = 4,
change = 5,
state = 6
};
std::string_view to_string (block_type);
class block_details
{
static_assert (std::is_same<std::underlying_type<nano::epoch>::type, uint8_t> (), "Epoch enum is not the proper type");
static_assert (static_cast<uint8_t> (nano::epoch::max) < (1 << 5), "Epoch max is too large for the sideband");
public:
block_details () = default;
block_details (nano::epoch const epoch_a, bool const is_send_a, bool const is_receive_a, bool const is_epoch_a);
static constexpr size_t size ()
{
return 1;
}
bool operator== (block_details const & other_a) const;
void serialize (nano::stream &) const;
bool deserialize (nano::stream &);
nano::epoch epoch{ nano::epoch::epoch_0 };
bool is_send{ false };
bool is_receive{ false };
bool is_epoch{ false };
private:
uint8_t packed () const;
void unpack (uint8_t);
public: // Logging
void operator() (nano::object_stream &) const;
};
std::string state_subtype (nano::block_details const);
class block_sideband final
{
public:
block_sideband () = default;
block_sideband (nano::account const &, nano::block_hash const &, nano::amount const &, uint64_t const, nano::seconds_t const local_timestamp, nano::block_details const &, nano::epoch const source_epoch_a);
block_sideband (nano::account const &, nano::block_hash const &, nano::amount const &, uint64_t const, nano::seconds_t const local_timestamp, nano::epoch const epoch_a, bool const is_send, bool const is_receive, bool const is_epoch, nano::epoch const source_epoch_a);
void serialize (nano::stream &, nano::block_type) const;
bool deserialize (nano::stream &, nano::block_type);
static size_t size (nano::block_type);
nano::block_hash successor{ 0 };
nano::account account{};
nano::amount balance{ 0 };
uint64_t height{ 0 };
uint64_t timestamp{ 0 };
nano::block_details details;
nano::epoch source_epoch{ nano::epoch::epoch_0 };
public: // Logging
void operator() (nano::object_stream &) const;
};
class object_stream;
class block
{
@ -146,8 +80,6 @@ public: // Logging
virtual void operator() (nano::object_stream &) const;
};
using block_list_t = std::vector<std::shared_ptr<nano::block>>;
class send_hashables
{
public:
@ -441,15 +373,9 @@ public:
virtual ~mutable_block_visitor () = default;
};
using block_uniquer = nano::uniquer<nano::uint256_union, nano::block>;
std::shared_ptr<nano::block> deserialize_block (nano::stream &);
std::shared_ptr<nano::block> deserialize_block (nano::stream &, nano::block_type, nano::block_uniquer * = nullptr);
std::shared_ptr<nano::block> deserialize_block_json (boost::property_tree::ptree const &, nano::block_uniquer * = nullptr);
/**
* Serialize block type as an 8-bit value
*/
void serialize_block_type (nano::stream &, nano::block_type const &);
/**
* Serialize a block prefixed with an 8-bit typecode
*/

View file

@ -1,3 +1,4 @@
#include <nano/crypto/blake2/blake2.h>
#include <nano/lib/blocks.hpp>
#include <nano/lib/config.hpp>
#include <nano/lib/logging.hpp>

View file

@ -1,3 +1,4 @@
#include <nano/crypto/blake2/blake2.h>
#include <nano/crypto_lib/random_pool.hpp>
#include <nano/lib/blocks.hpp>
#include <nano/lib/epoch.hpp>

View file

@ -4,6 +4,7 @@
#include <nano/boost/beast/core/flat_buffer.hpp>
#include <nano/boost/beast/http.hpp>
#include <nano/boost/process/child.hpp>
#include <nano/lib/blocks.hpp>
#include <nano/lib/logging.hpp>
#include <nano/lib/thread_runner.hpp>
#include <nano/lib/threading.hpp>

View file

@ -1,4 +1,5 @@
#include <nano/crypto_lib/random_pool.hpp>
#include <nano/lib/blocks.hpp>
#include <nano/lib/cli.hpp>
#include <nano/lib/thread_runner.hpp>
#include <nano/lib/utility.hpp>

View file

@ -1,3 +1,4 @@
#include <nano/lib/blocks.hpp>
#include <nano/lib/threading.hpp>
#include <nano/node/active_transactions.hpp>
#include <nano/node/confirmation_height_processor.hpp>

View file

@ -1,3 +1,4 @@
#include <nano/lib/blocks.hpp>
#include <nano/lib/threading.hpp>
#include <nano/lib/timer.hpp>
#include <nano/node/blockprocessor.hpp>

View file

@ -1,6 +1,5 @@
#pragma once
#include <nano/lib/blocks.hpp>
#include <nano/lib/logging.hpp>
#include <nano/secure/common.hpp>
@ -10,6 +9,13 @@
#include <optional>
#include <thread>
namespace nano
{
class block;
class node;
class write_database_queue;
}
namespace nano::store
{
class write_transaction;
@ -17,8 +23,6 @@ class write_transaction;
namespace nano
{
class node;
class write_database_queue;
enum class block_source
{

View file

@ -1,6 +1,8 @@
#pragma once
#include <nano/lib/blocks.hpp>
#include <nano/lib/block_type.hpp>
#include <boost/system/error_code.hpp>
#include <memory>
#include <vector>

View file

@ -1,3 +1,4 @@
#include <nano/lib/blocks.hpp>
#include <nano/node/bootstrap/bootstrap.hpp>
#include <nano/node/bootstrap/bootstrap_attempt.hpp>
#include <nano/node/bootstrap/bootstrap_bulk_push.hpp>

View file

@ -1,3 +1,4 @@
#include <nano/lib/blocks.hpp>
#include <nano/node/bootstrap/block_deserializer.hpp>
#include <nano/node/bootstrap/bootstrap.hpp>
#include <nano/node/bootstrap/bootstrap_bulk_pull.hpp>

View file

@ -1,3 +1,4 @@
#include <nano/lib/blocks.hpp>
#include <nano/node/bootstrap/bootstrap_attempt.hpp>
#include <nano/node/bootstrap/bootstrap_bulk_push.hpp>
#include <nano/node/bootstrap/bootstrap_legacy.hpp>

View file

@ -1,7 +1,10 @@
#pragma once
#include <nano/lib/numbers.hpp>
#include <deque>
#include <future>
#include <memory>
namespace nano
{

View file

@ -1,3 +1,4 @@
#include <nano/lib/blocks.hpp>
#include <nano/node/bootstrap/bootstrap.hpp>
#include <nano/node/bootstrap/bootstrap_lazy.hpp>
#include <nano/node/common.hpp>

View file

@ -1,3 +1,4 @@
#include <nano/lib/blocks.hpp>
#include <nano/lib/utility.hpp>
#include <nano/node/bootstrap/bootstrap_server.hpp>
#include <nano/node/transport/channel.hpp>

View file

@ -1,3 +1,4 @@
#include <nano/lib/blocks.hpp>
#include <nano/lib/stats_enums.hpp>
#include <nano/node/blockprocessor.hpp>
#include <nano/node/bootstrap_ascending/service.hpp>

View file

@ -1,3 +1,4 @@
#include <nano/lib/blocks.hpp>
#include <nano/lib/cli.hpp>
#include <nano/lib/tlsconfig.hpp>
#include <nano/lib/tomlconfig.hpp>

View file

@ -1,3 +1,4 @@
#include <nano/lib/blocks.hpp>
#include <nano/lib/stats.hpp>
#include <nano/node/confirmation_height_bounded.hpp>
#include <nano/node/write_database_queue.hpp>

View file

@ -1,3 +1,4 @@
#include <nano/lib/blocks.hpp>
#include <nano/lib/numbers.hpp>
#include <nano/lib/thread_roles.hpp>
#include <nano/lib/utility.hpp>
@ -239,3 +240,8 @@ nano::block_hash nano::confirmation_height_processor::current () const
nano::lock_guard<nano::mutex> lk (mutex);
return original_block ? original_block->hash () : 0;
}
std::reference_wrapper<nano::block_hash const> nano::confirmation_height_processor::block_wrapper::hash () const
{
return block->hash ();
}

View file

@ -65,10 +65,7 @@ private:
{
}
std::reference_wrapper<nano::block_hash const> hash () const
{
return block->hash ();
}
std::reference_wrapper<nano::block_hash const> hash () const;
std::shared_ptr<nano::block> block;
};

View file

@ -1,3 +1,4 @@
#include <nano/lib/blocks.hpp>
#include <nano/lib/stats.hpp>
#include <nano/node/confirmation_height_unbounded.hpp>
#include <nano/node/write_database_queue.hpp>

View file

@ -1,3 +1,4 @@
#include <nano/lib/blocks.hpp>
#include <nano/node/confirmation_solicitor.hpp>
#include <nano/node/election.hpp>
#include <nano/node/nodeconfig.hpp>

View file

@ -1,3 +1,4 @@
#include <nano/lib/blocks.hpp>
#include <nano/node/confirmation_solicitor.hpp>
#include <nano/node/election.hpp>
#include <nano/node/network.hpp>
@ -801,4 +802,4 @@ void nano::election_extended_status::operator() (nano::object_stream & obs) cons
obs.write ("hash", block->hash ().to_string ());
obs.write ("amount", amount);
});
}
}

View file

@ -1,3 +1,4 @@
#include <nano/lib/blocks.hpp>
#include <nano/lib/threading.hpp>
#include <nano/node/epoch_upgrader.hpp>
#include <nano/node/node.hpp>

View file

@ -1,3 +1,4 @@
#include <nano/lib/blocks.hpp>
#include <nano/lib/config.hpp>
#include <nano/lib/json_error_response.hpp>
#include <nano/lib/timer.hpp>

View file

@ -1,3 +1,4 @@
#include <nano/lib/blocks.hpp>
#include <nano/lib/threading.hpp>
#include <nano/lib/utility.hpp>
#include <nano/node/blockprocessor.hpp>
@ -167,4 +168,9 @@ std::unique_ptr<nano::container_info_component> nano::local_block_broadcaster::c
auto composite = std::make_unique<container_info_composite> (name);
composite->add_component (std::make_unique<container_info_leaf> (container_info{ "local", local_blocks.size (), sizeof (decltype (local_blocks)::value_type) }));
return composite;
}
}
nano::block_hash nano::local_block_broadcaster::local_entry::hash () const
{
return block->hash ();
}

View file

@ -1,6 +1,5 @@
#pragma once
#include <nano/lib/blocks.hpp>
#include <nano/lib/locks.hpp>
#include <nano/lib/processing_queue.hpp>
#include <nano/node/bandwidth_limiter.hpp>
@ -66,10 +65,7 @@ private:
std::chrono::steady_clock::time_point const arrival;
mutable std::chrono::steady_clock::time_point last_broadcast{}; // Not part of any index
nano::block_hash hash () const
{
return block->hash ();
}
nano::block_hash hash () const;
};
// clang-format off

View file

@ -1,7 +1,7 @@
#pragma once
#include <nano/lib/asio.hpp>
#include <nano/lib/blocks.hpp>
#include <nano/lib/block_uniquer.hpp>
#include <nano/lib/config.hpp>
#include <nano/lib/errors.hpp>
#include <nano/lib/jsonconfig.hpp>

View file

@ -1,4 +1,5 @@
#include <nano/crypto_lib/random_pool_shuffle.hpp>
#include <nano/lib/blocks.hpp>
#include <nano/lib/threading.hpp>
#include <nano/lib/utility.hpp>
#include <nano/node/bootstrap_ascending/service.hpp>

View file

@ -1,3 +1,4 @@
#include <nano/lib/blocks.hpp>
#include <nano/lib/stream.hpp>
#include <nano/lib/tomlconfig.hpp>
#include <nano/lib/utility.hpp>

View file

@ -1,5 +1,6 @@
#pragma once
#include <nano/lib/block_uniquer.hpp>
#include <nano/lib/config.hpp>
#include <nano/lib/logging.hpp>
#include <nano/lib/stats.hpp>

View file

@ -1,4 +1,5 @@
#include <nano/crypto_lib/random_pool.hpp>
#include <nano/lib/blocks.hpp>
#include <nano/lib/config.hpp>
#include <nano/lib/jsonconfig.hpp>
#include <nano/lib/rpcconfig.hpp>
@ -560,4 +561,4 @@ nano::account nano::node_config::random_representative () const
std::size_t index (nano::random_pool::generate_word32 (0, static_cast<CryptoPP::word32> (preconfigured_representatives.size () - 1)));
auto result (preconfigured_representatives[index]);
return result;
}
}

View file

@ -1,3 +1,4 @@
#include <nano/lib/blocks.hpp>
#include <nano/lib/stats.hpp>
#include <nano/node/active_transactions.hpp>
#include <nano/node/common.hpp>

View file

@ -1,3 +1,4 @@
#include <nano/lib/blocks.hpp>
#include <nano/lib/stats.hpp>
#include <nano/lib/tomlconfig.hpp>
#include <nano/node/node.hpp>

View file

@ -1,3 +1,4 @@
#include <nano/lib/blocks.hpp>
#include <nano/node/node.hpp>
#include <nano/node/scheduler/buckets.hpp>
#include <nano/node/scheduler/priority.hpp>

View file

@ -1,3 +1,4 @@
#include <nano/lib/blocks.hpp>
#include <nano/lib/stats.hpp>
#include <nano/lib/threading.hpp>
#include <nano/node/network.hpp>
@ -439,4 +440,4 @@ nano::telemetry_data nano::consolidate_telemetry_data (std::vector<nano::telemet
consolidated_data.maker = boost::lexical_cast<uint8_t> (version_fragments[4]);
return consolidated_data;
}
}

View file

@ -1,3 +1,4 @@
#include <nano/lib/blocks.hpp>
#include <nano/lib/locks.hpp>
#include <nano/lib/stats.hpp>
#include <nano/lib/stats_enums.hpp>

View file

@ -1,3 +1,4 @@
#include <nano/lib/blocks.hpp>
#include <nano/lib/stats.hpp>
#include <nano/lib/utility.hpp>
#include <nano/node/network.hpp>

View file

@ -1,4 +1,5 @@
#include <nano/crypto_lib/random_pool.hpp>
#include <nano/lib/blocks.hpp>
#include <nano/lib/threading.hpp>
#include <nano/lib/utility.hpp>
#include <nano/node/election.hpp>

View file

@ -1,6 +1,7 @@
#include <nano/boost/asio/bind_executor.hpp>
#include <nano/boost/asio/dispatch.hpp>
#include <nano/boost/asio/strand.hpp>
#include <nano/lib/blocks.hpp>
#include <nano/lib/logging.hpp>
#include <nano/lib/tlsconfig.hpp>
#include <nano/lib/work.hpp>
@ -1078,4 +1079,4 @@ void nano::websocket_server::stop ()
{
server->stop ();
}
}
}

View file

@ -1,6 +1,5 @@
#pragma once
#include <nano/lib/blocks.hpp>
#include <nano/lib/numbers.hpp>
#include <nano/lib/work.hpp>
#include <nano/node/common.hpp>
@ -20,6 +19,7 @@
namespace nano
{
class block;
class wallets;
class logger;
class vote;

View file

@ -1,3 +1,4 @@
#include <nano/lib/blocks.hpp>
#include <nano/lib/config.hpp>
#include <nano/qt/qt.hpp>

View file

@ -1,3 +1,4 @@
#include <nano/lib/blocks.hpp>
#include <nano/node/make_store.hpp>
#include <nano/qt/qt.hpp>
#include <nano/test_common/network.hpp>

View file

@ -1,3 +1,4 @@
#include <nano/lib/blocks.hpp>
#include <nano/node/ipc/ipc_server.hpp>
#include <nano/rpc/rpc_request_processor.hpp>
#include <nano/rpc_test/common.hpp>

View file

@ -1,5 +1,6 @@
#include <nano/boost/beast/core/flat_buffer.hpp>
#include <nano/boost/beast/http.hpp>
#include <nano/lib/blocks.hpp>
#include <nano/lib/rpcconfig.hpp>
#include <nano/lib/thread_runner.hpp>
#include <nano/lib/threading.hpp>

View file

@ -1,4 +1,5 @@
#include <nano/crypto_lib/random_pool.hpp>
#include <nano/lib/blocks.hpp>
#include <nano/lib/config.hpp>
#include <nano/lib/numbers.hpp>
#include <nano/lib/timer.hpp>
@ -17,12 +18,6 @@
#include <cryptopp/words.h>
#include <magic_enum.hpp>
size_t constexpr nano::send_block::size;
size_t constexpr nano::receive_block::size;
size_t constexpr nano::open_block::size;
size_t constexpr nano::change_block::size;
size_t constexpr nano::state_block::size;
nano::networks nano::network_constants::active_network = nano::networks::ACTIVE_NETWORK;
namespace

View file

@ -2,7 +2,6 @@
#include <nano/crypto/blake2/blake2.h>
#include <nano/lib/blockbuilders.hpp>
#include <nano/lib/blocks.hpp>
#include <nano/lib/config.hpp>
#include <nano/lib/epoch.hpp>
#include <nano/lib/numbers.hpp>

View file

@ -1,3 +1,4 @@
#include <nano/lib/blocks.hpp>
#include <nano/lib/logging.hpp>
#include <nano/lib/rep_weights.hpp>
#include <nano/lib/stats.hpp>

View file

@ -1,4 +1,5 @@
#include <nano/crypto_lib/random_pool.hpp>
#include <nano/lib/blocks.hpp>
#include <nano/lib/locks.hpp>
#include <nano/lib/stream.hpp>
#include <nano/secure/common.hpp>

View file

@ -2,6 +2,8 @@
#include <nano/secure/utility.hpp>
#include <nano/secure/working.hpp>
#include <boost/system/error_code.hpp>
#include <random>
static std::vector<std::filesystem::path> all_unique_paths;

View file

@ -1,4 +1,5 @@
#include <nano/crypto_lib/random_pool.hpp>
#include <nano/lib/blocks.hpp>
#include <nano/lib/logging.hpp>
#include <nano/lib/thread_runner.hpp>
#include <nano/node/election.hpp>

View file

@ -1,3 +1,4 @@
#include <nano/lib/blocks.hpp>
#include <nano/test_common/rate_observer.hpp>
#include <nano/test_common/system.hpp>
#include <nano/test_common/testutil.hpp>

View file

@ -1,3 +1,4 @@
#include <nano/lib/blocks.hpp>
#include <nano/node/transport/inproc.hpp>
#include <nano/node/vote_processor.hpp>
#include <nano/test_common/system.hpp>

View file

@ -5,6 +5,7 @@ add_library(
component.hpp
confirmation_height.hpp
db_val.hpp
db_val_impl.hpp
iterator.hpp
iterator_impl.hpp
final.hpp

View file

@ -1,6 +1,6 @@
#pragma once
#include <nano/lib/blocks.hpp>
#include <nano/lib/block_sideband.hpp>
#include <nano/lib/numbers.hpp>
#include <nano/store/component.hpp>
#include <nano/store/iterator.hpp>
@ -9,6 +9,7 @@
namespace nano
{
class block;
class block_hash;
}
namespace nano::store

View file

@ -1,3 +1,4 @@
#include <nano/lib/blocks.hpp>
#include <nano/lib/timer.hpp>
#include <nano/store/account.hpp>
#include <nano/store/block.hpp>

View file

@ -9,6 +9,11 @@
#include <cstddef>
namespace nano
{
class block;
}
namespace nano::store
{
/**
@ -92,15 +97,7 @@ public:
static_assert (std::is_standard_layout<nano::endpoint_key>::value, "Standard layout is required");
}
db_val (std::shared_ptr<nano::block> const & val_a) :
buffer (std::make_shared<std::vector<uint8_t>> ())
{
{
nano::vectorstream stream (*buffer);
nano::serialize_block (stream, *val_a);
}
convert_buffer_to_value ();
}
db_val (std::shared_ptr<nano::block> const & val_a);
db_val (uint64_t val_a) :
buffer (std::make_shared<std::vector<uint8_t>> ())
@ -209,16 +206,7 @@ public:
return result;
}
explicit operator block_w_sideband () const
{
nano::bufferstream stream (reinterpret_cast<uint8_t const *> (data ()), size ());
nano::store::block_w_sideband block_w_sideband;
block_w_sideband.block = (nano::deserialize_block (stream));
auto error = block_w_sideband.sideband.deserialize (stream, block_w_sideband.block->type ());
release_assert (!error);
block_w_sideband.block->sideband_set (block_w_sideband.sideband);
return block_w_sideband;
}
explicit operator block_w_sideband () const;
explicit operator std::nullptr_t () const
{
@ -230,12 +218,7 @@ public:
return no_value::dummy;
}
explicit operator std::shared_ptr<nano::block> () const
{
nano::bufferstream stream (reinterpret_cast<uint8_t const *> (data ()), size ());
std::shared_ptr<nano::block> result (nano::deserialize_block (stream));
return result;
}
explicit operator std::shared_ptr<nano::block> () const;
template <typename Block>
std::shared_ptr<Block> convert_to_block () const

View file

@ -0,0 +1,33 @@
#include <nano/lib/blocks.hpp>
#include <nano/store/db_val.hpp>
template <typename T>
nano::store::db_val<T>::db_val (std::shared_ptr<nano::block> const & val_a) :
buffer (std::make_shared<std::vector<uint8_t>> ())
{
{
nano::vectorstream stream (*buffer);
nano::serialize_block (stream, *val_a);
}
convert_buffer_to_value ();
}
template <typename T>
nano::store::db_val<T>::operator std::shared_ptr<nano::block> () const
{
nano::bufferstream stream (reinterpret_cast<uint8_t const *> (data ()), size ());
std::shared_ptr<nano::block> result (nano::deserialize_block (stream));
return result;
}
template <typename T>
nano::store::db_val<T>::operator nano::store::block_w_sideband () const
{
nano::bufferstream stream (reinterpret_cast<uint8_t const *> (data ()), size ());
nano::store::block_w_sideband block_w_sideband;
block_w_sideband.block = (nano::deserialize_block (stream));
auto error = block_w_sideband.sideband.deserialize (stream, block_w_sideband.block->type ());
release_assert (!error);
block_w_sideband.block->sideband_set (block_w_sideband.sideband);
return block_w_sideband;
}

View file

@ -1,4 +1,5 @@
#include <nano/secure/parallel_traversal.hpp>
#include <nano/store/db_val_impl.hpp>
#include <nano/store/lmdb/block.hpp>
#include <nano/store/lmdb/lmdb.hpp>

Some files were not shown because too many files have changed in this diff Show more