Merge branch 'develop' into remove-legacy-bootstrap-2
# Conflicts: # nano/node/bootstrap/account_sets.hpp # nano/node/bootstrap/bootstrap.cpp # nano/node/bootstrap/bootstrap.hpp # nano/node/bootstrap/bootstrap_attempt.hpp # nano/node/bootstrap/bootstrap_bulk_push.cpp # nano/node/bootstrap/bootstrap_bulk_push.hpp # nano/node/bootstrap/bootstrap_connections.cpp # nano/node/bootstrap/bootstrap_connections.hpp # nano/node/bootstrap/bootstrap_lazy.cpp # nano/node/json_handler.cpp
This commit is contained in:
commit
40d231061a
149 changed files with 934 additions and 702 deletions
|
|
@ -35,6 +35,8 @@ endif()
|
|||
|
||||
if(MSVC)
|
||||
add_definitions(/MP)
|
||||
add_definitions(
|
||||
-D_SILENCE_STDEXT_ARR_ITERS_DEPRECATION_WARNING) # Suppress iterator warning
|
||||
endif()
|
||||
|
||||
set(CPACK_PACKAGE_VENDOR "Nano Currency")
|
||||
|
|
|
|||
|
|
@ -6,11 +6,13 @@
|
|||
#include <nano/node/scheduler/component.hpp>
|
||||
#include <nano/node/scheduler/manual.hpp>
|
||||
#include <nano/node/scheduler/priority.hpp>
|
||||
#include <nano/node/transport/fake.hpp>
|
||||
#include <nano/node/transport/inproc.hpp>
|
||||
#include <nano/node/vote_router.hpp>
|
||||
#include <nano/secure/ledger.hpp>
|
||||
#include <nano/secure/ledger_set_any.hpp>
|
||||
#include <nano/secure/ledger_set_confirmed.hpp>
|
||||
#include <nano/secure/vote.hpp>
|
||||
#include <nano/test_common/chains.hpp>
|
||||
#include <nano/test_common/system.hpp>
|
||||
#include <nano/test_common/testutil.hpp>
|
||||
|
|
|
|||
|
|
@ -1,6 +1,9 @@
|
|||
#include <nano/lib/block_uniquer.hpp>
|
||||
#include <nano/lib/blocks.hpp>
|
||||
#include <nano/lib/stream.hpp>
|
||||
#include <nano/node/common.hpp>
|
||||
#include <nano/lib/work_version.hpp>
|
||||
#include <nano/node/endpoint.hpp>
|
||||
#include <nano/node/messages.hpp>
|
||||
#include <nano/test_common/testutil.hpp>
|
||||
|
||||
#include <gtest/gtest.h>
|
||||
|
|
|
|||
|
|
@ -1,11 +1,12 @@
|
|||
#include <nano/crypto_lib/random_pool.hpp>
|
||||
#include <nano/lib/block_type.hpp>
|
||||
#include <nano/lib/blocks.hpp>
|
||||
#include <nano/lib/lmdbconfig.hpp>
|
||||
#include <nano/lib/logging.hpp>
|
||||
#include <nano/lib/stats.hpp>
|
||||
#include <nano/lib/utility.hpp>
|
||||
#include <nano/lib/work.hpp>
|
||||
#include <nano/node/common.hpp>
|
||||
#include <nano/node/endpoint.hpp>
|
||||
#include <nano/node/make_store.hpp>
|
||||
#include <nano/secure/common.hpp>
|
||||
#include <nano/secure/ledger.hpp>
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
#include <nano/lib/blocks.hpp>
|
||||
#include <nano/node/transport/fake.hpp>
|
||||
#include <nano/test_common/chains.hpp>
|
||||
#include <nano/test_common/system.hpp>
|
||||
#include <nano/test_common/testutil.hpp>
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@
|
|||
#include <nano/node/scheduler/component.hpp>
|
||||
#include <nano/node/scheduler/priority.hpp>
|
||||
#include <nano/secure/ledger.hpp>
|
||||
#include <nano/secure/vote.hpp>
|
||||
#include <nano/test_common/chains.hpp>
|
||||
#include <nano/test_common/system.hpp>
|
||||
#include <nano/test_common/testutil.hpp>
|
||||
|
|
|
|||
|
|
@ -1,8 +1,10 @@
|
|||
#include <nano/lib/block_type.hpp>
|
||||
#include <nano/lib/blocks.hpp>
|
||||
#include <nano/lib/config.hpp>
|
||||
#include <nano/lib/epoch.hpp>
|
||||
#include <nano/lib/numbers.hpp>
|
||||
#include <nano/lib/work.hpp>
|
||||
#include <nano/lib/work_version.hpp>
|
||||
#include <nano/secure/common.hpp>
|
||||
#include <nano/test_common/testutil.hpp>
|
||||
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
#include <nano/core_test/fakes/work_peer.hpp>
|
||||
#include <nano/lib/work_version.hpp>
|
||||
#include <nano/test_common/system.hpp>
|
||||
#include <nano/test_common/testutil.hpp>
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
#include <nano/lib/logging.hpp>
|
||||
#include <nano/node/common.hpp>
|
||||
#include <nano/lib/memory.hpp>
|
||||
#include <nano/secure/utility.hpp>
|
||||
|
||||
#include <gtest/gtest.h>
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
#include <nano/node/fair_queue.hpp>
|
||||
#include <nano/node/transport/fake.hpp>
|
||||
#include <nano/test_common/system.hpp>
|
||||
#include <nano/test_common/testutil.hpp>
|
||||
|
||||
|
|
|
|||
|
|
@ -4,7 +4,8 @@
|
|||
#include <nano/lib/locks.hpp>
|
||||
#include <nano/lib/numbers.hpp>
|
||||
#include <nano/lib/work.hpp>
|
||||
#include <nano/node/common.hpp>
|
||||
#include <nano/lib/work_version.hpp>
|
||||
#include <nano/node/endpoint.hpp>
|
||||
|
||||
#include <boost/asio.hpp>
|
||||
#include <boost/asio/steady_timer.hpp>
|
||||
|
|
|
|||
|
|
@ -12,6 +12,7 @@
|
|||
#include <nano/node/vote_router.hpp>
|
||||
#include <nano/secure/ledger_set_any.hpp>
|
||||
#include <nano/secure/ledger_set_confirmed.hpp>
|
||||
#include <nano/secure/vote.hpp>
|
||||
#include <nano/store/rocksdb/rocksdb.hpp>
|
||||
#include <nano/test_common/ledger_context.hpp>
|
||||
#include <nano/test_common/make_store.hpp>
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@
|
|||
#include <nano/lib/memory.hpp>
|
||||
#include <nano/node/active_elections.hpp>
|
||||
#include <nano/secure/common.hpp>
|
||||
#include <nano/secure/vote.hpp>
|
||||
|
||||
#include <gtest/gtest.h>
|
||||
|
||||
|
|
|
|||
|
|
@ -1,8 +1,9 @@
|
|||
#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/endpoint.hpp>
|
||||
#include <nano/node/network.hpp>
|
||||
#include <nano/secure/vote.hpp>
|
||||
#include <nano/test_common/testutil.hpp>
|
||||
|
||||
#include <gtest/gtest.h>
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
#include <nano/lib/blocks.hpp>
|
||||
#include <nano/node/transport/message_deserializer.hpp>
|
||||
#include <nano/secure/vote.hpp>
|
||||
#include <nano/test_common/system.hpp>
|
||||
#include <nano/test_common/testutil.hpp>
|
||||
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@
|
|||
#include <nano/node/nodeconfig.hpp>
|
||||
#include <nano/node/scheduler/component.hpp>
|
||||
#include <nano/node/scheduler/priority.hpp>
|
||||
#include <nano/node/transport/fake.hpp>
|
||||
#include <nano/node/transport/inproc.hpp>
|
||||
#include <nano/node/transport/tcp_listener.hpp>
|
||||
#include <nano/node/transport/tcp_socket.hpp>
|
||||
|
|
|
|||
|
|
@ -1,7 +1,8 @@
|
|||
#include <nano/lib/blocks.hpp>
|
||||
#include <nano/lib/network_filter.hpp>
|
||||
#include <nano/lib/stream.hpp>
|
||||
#include <nano/node/common.hpp>
|
||||
#include <nano/node/endpoint.hpp>
|
||||
#include <nano/node/messages.hpp>
|
||||
#include <nano/secure/common.hpp>
|
||||
#include <nano/test_common/testutil.hpp>
|
||||
|
||||
|
|
@ -163,4 +164,4 @@ TEST (network_filter, expire)
|
|||
|
||||
ASSERT_FALSE (filter.check (2)); // Entry with epoch 1 should be expired
|
||||
ASSERT_FALSE (filter.apply (2)); // Entry with epoch 1 should be replaced
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
#include <nano/lib/blocks.hpp>
|
||||
#include <nano/lib/config.hpp>
|
||||
#include <nano/lib/logging.hpp>
|
||||
#include <nano/lib/work_version.hpp>
|
||||
#include <nano/node/active_elections.hpp>
|
||||
#include <nano/node/confirming_set.hpp>
|
||||
#include <nano/node/election.hpp>
|
||||
|
|
@ -19,6 +20,7 @@
|
|||
#include <nano/secure/ledger.hpp>
|
||||
#include <nano/secure/ledger_set_any.hpp>
|
||||
#include <nano/secure/ledger_set_confirmed.hpp>
|
||||
#include <nano/secure/vote.hpp>
|
||||
#include <nano/test_common/network.hpp>
|
||||
#include <nano/test_common/system.hpp>
|
||||
#include <nano/test_common/testutil.hpp>
|
||||
|
|
@ -3692,4 +3694,4 @@ TEST (node, container_info)
|
|||
// This should just execute, sanitizers will catch any problems
|
||||
ASSERT_NO_THROW (node1.container_info ());
|
||||
ASSERT_NO_THROW (node2.container_info ());
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
#include <nano/lib/numbers.hpp>
|
||||
#include <nano/lib/numbers_templ.hpp>
|
||||
#include <nano/secure/common.hpp>
|
||||
|
||||
#include <gtest/gtest.h>
|
||||
|
|
@ -647,4 +648,4 @@ TEST (uint512_union, hash)
|
|||
ASSERT_NE (h (x1), h (x2));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@
|
|||
#include <nano/node/transport/fake.hpp>
|
||||
#include <nano/node/transport/inproc.hpp>
|
||||
#include <nano/secure/ledger.hpp>
|
||||
#include <nano/secure/vote.hpp>
|
||||
#include <nano/test_common/chains.hpp>
|
||||
#include <nano/test_common/network.hpp>
|
||||
#include <nano/test_common/system.hpp>
|
||||
|
|
@ -327,4 +328,4 @@ TEST (rep_crawler, ignore_rebroadcasted)
|
|||
};
|
||||
|
||||
ASSERT_NEVER (1s, tick () || node1.rep_crawler.representative_count () > 0);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@
|
|||
#include <nano/node/election.hpp>
|
||||
#include <nano/node/local_vote_history.hpp>
|
||||
#include <nano/node/request_aggregator.hpp>
|
||||
#include <nano/node/transport/fake.hpp>
|
||||
#include <nano/node/transport/inproc.hpp>
|
||||
#include <nano/secure/ledger.hpp>
|
||||
#include <nano/secure/ledger_set_confirmed.hpp>
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
#include <nano/lib/blocks.hpp>
|
||||
#include <nano/lib/thread_runner.hpp>
|
||||
#include <nano/lib/work_version.hpp>
|
||||
#include <nano/node/transport/inproc.hpp>
|
||||
#include <nano/secure/ledger.hpp>
|
||||
#include <nano/secure/ledger_set_any.hpp>
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
#include <nano/node/telemetry.hpp>
|
||||
#include <nano/node/transport/fake.hpp>
|
||||
#include <nano/test_common/network.hpp>
|
||||
#include <nano/test_common/system.hpp>
|
||||
#include <nano/test_common/telemetry.hpp>
|
||||
|
|
|
|||
|
|
@ -2,10 +2,12 @@
|
|||
#include <nano/lib/jsonconfig.hpp>
|
||||
#include <nano/node/active_elections.hpp>
|
||||
#include <nano/node/election.hpp>
|
||||
#include <nano/node/transport/fake.hpp>
|
||||
#include <nano/node/transport/inproc.hpp>
|
||||
#include <nano/node/vote_processor.hpp>
|
||||
#include <nano/node/vote_router.hpp>
|
||||
#include <nano/secure/ledger.hpp>
|
||||
#include <nano/secure/vote.hpp>
|
||||
#include <nano/test_common/chains.hpp>
|
||||
#include <nano/test_common/system.hpp>
|
||||
#include <nano/test_common/testutil.hpp>
|
||||
|
|
|
|||
|
|
@ -1,9 +1,10 @@
|
|||
#include <nano/lib/blocks.hpp>
|
||||
#include <nano/node/common.hpp>
|
||||
#include <nano/node/endpoint.hpp>
|
||||
#include <nano/node/local_vote_history.hpp>
|
||||
#include <nano/node/vote_generator.hpp>
|
||||
#include <nano/node/vote_spacing.hpp>
|
||||
#include <nano/secure/ledger.hpp>
|
||||
#include <nano/secure/vote.hpp>
|
||||
#include <nano/test_common/system.hpp>
|
||||
#include <nano/test_common/testutil.hpp>
|
||||
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
#include <nano/crypto_lib/random_pool.hpp>
|
||||
#include <nano/lib/blocks.hpp>
|
||||
#include <nano/lib/thread_runner.hpp>
|
||||
#include <nano/lib/work_version.hpp>
|
||||
#include <nano/node/active_elections.hpp>
|
||||
#include <nano/node/election.hpp>
|
||||
#include <nano/secure/ledger.hpp>
|
||||
|
|
|
|||
|
|
@ -1,5 +1,7 @@
|
|||
#include <nano/core_test/fakes/websocket_client.hpp>
|
||||
#include <nano/lib/blocks.hpp>
|
||||
#include <nano/lib/jsonconfig.hpp>
|
||||
#include <nano/lib/work_version.hpp>
|
||||
#include <nano/node/active_elections.hpp>
|
||||
#include <nano/node/telemetry.hpp>
|
||||
#include <nano/node/transport/fake.hpp>
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@
|
|||
#include <nano/lib/logging.hpp>
|
||||
#include <nano/lib/timer.hpp>
|
||||
#include <nano/lib/work.hpp>
|
||||
#include <nano/lib/work_version.hpp>
|
||||
#include <nano/node/openclconfig.hpp>
|
||||
#include <nano/node/openclwork.hpp>
|
||||
#include <nano/secure/common.hpp>
|
||||
|
|
|
|||
|
|
@ -33,6 +33,7 @@ add_library(
|
|||
char_traits.hpp
|
||||
cli.hpp
|
||||
cli.cpp
|
||||
common.hpp
|
||||
config.hpp
|
||||
config.cpp
|
||||
configbase.hpp
|
||||
|
|
@ -44,8 +45,11 @@ add_library(
|
|||
env.cpp
|
||||
epoch.hpp
|
||||
epoch.cpp
|
||||
epochs.cpp
|
||||
epochs.hpp
|
||||
errors.hpp
|
||||
errors.cpp
|
||||
fwd.hpp
|
||||
id_dispenser.hpp
|
||||
interval.hpp
|
||||
ipc.hpp
|
||||
|
|
@ -69,6 +73,7 @@ add_library(
|
|||
network_filter.cpp
|
||||
numbers.hpp
|
||||
numbers.cpp
|
||||
numbers_templ.hpp
|
||||
object_stream.hpp
|
||||
object_stream.cpp
|
||||
object_stream_adapters.hpp
|
||||
|
|
@ -110,7 +115,8 @@ add_library(
|
|||
walletconfig.hpp
|
||||
walletconfig.cpp
|
||||
work.hpp
|
||||
work.cpp)
|
||||
work.cpp
|
||||
work_version.hpp)
|
||||
|
||||
include_directories(${CMAKE_SOURCE_DIR}/submodules)
|
||||
include_directories(
|
||||
|
|
|
|||
|
|
@ -0,0 +1,216 @@
|
|||
#include <nano/lib/block_sideband.hpp>
|
||||
#include <nano/lib/block_type.hpp>
|
||||
#include <nano/lib/object_stream.hpp>
|
||||
#include <nano/lib/stream.hpp>
|
||||
|
||||
#include <bitset>
|
||||
|
||||
/*
|
||||
* block_details
|
||||
*/
|
||||
|
||||
nano::block_details::block_details (nano::epoch const epoch_a, bool const is_send_a, bool const is_receive_a, bool const is_epoch_a) :
|
||||
epoch (epoch_a), is_send (is_send_a), is_receive (is_receive_a), is_epoch (is_epoch_a)
|
||||
{
|
||||
}
|
||||
|
||||
bool nano::block_details::operator== (nano::block_details const & other_a) const
|
||||
{
|
||||
return epoch == other_a.epoch && is_send == other_a.is_send && is_receive == other_a.is_receive && is_epoch == other_a.is_epoch;
|
||||
}
|
||||
|
||||
uint8_t nano::block_details::packed () const
|
||||
{
|
||||
std::bitset<8> result (static_cast<uint8_t> (epoch));
|
||||
result.set (7, is_send);
|
||||
result.set (6, is_receive);
|
||||
result.set (5, is_epoch);
|
||||
return static_cast<uint8_t> (result.to_ulong ());
|
||||
}
|
||||
|
||||
void nano::block_details::unpack (uint8_t details_a)
|
||||
{
|
||||
constexpr std::bitset<8> epoch_mask{ 0b00011111 };
|
||||
auto as_bitset = static_cast<std::bitset<8>> (details_a);
|
||||
is_send = as_bitset.test (7);
|
||||
is_receive = as_bitset.test (6);
|
||||
is_epoch = as_bitset.test (5);
|
||||
epoch = static_cast<nano::epoch> ((as_bitset & epoch_mask).to_ulong ());
|
||||
}
|
||||
|
||||
void nano::block_details::serialize (nano::stream & stream_a) const
|
||||
{
|
||||
nano::write (stream_a, packed ());
|
||||
}
|
||||
|
||||
bool nano::block_details::deserialize (nano::stream & stream_a)
|
||||
{
|
||||
bool result (false);
|
||||
try
|
||||
{
|
||||
uint8_t packed{ 0 };
|
||||
nano::read (stream_a, packed);
|
||||
unpack (packed);
|
||||
}
|
||||
catch (std::runtime_error &)
|
||||
{
|
||||
result = true;
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
void nano::block_details::operator() (nano::object_stream & obs) const
|
||||
{
|
||||
obs.write ("epoch", epoch);
|
||||
obs.write ("is_send", is_send);
|
||||
obs.write ("is_receive", is_receive);
|
||||
obs.write ("is_epoch", is_epoch);
|
||||
}
|
||||
|
||||
std::string nano::state_subtype (nano::block_details const details_a)
|
||||
{
|
||||
debug_assert (details_a.is_epoch + details_a.is_receive + details_a.is_send <= 1);
|
||||
if (details_a.is_send)
|
||||
{
|
||||
return "send";
|
||||
}
|
||||
else if (details_a.is_receive)
|
||||
{
|
||||
return "receive";
|
||||
}
|
||||
else if (details_a.is_epoch)
|
||||
{
|
||||
return "epoch";
|
||||
}
|
||||
else
|
||||
{
|
||||
return "change";
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* block_sideband
|
||||
*/
|
||||
|
||||
nano::block_sideband::block_sideband (nano::account const & account_a, nano::block_hash const & successor_a, nano::amount const & balance_a, uint64_t const height_a, nano::seconds_t const timestamp_a, nano::block_details const & details_a, nano::epoch const source_epoch_a) :
|
||||
successor (successor_a),
|
||||
account (account_a),
|
||||
balance (balance_a),
|
||||
height (height_a),
|
||||
timestamp (timestamp_a),
|
||||
details (details_a),
|
||||
source_epoch (source_epoch_a)
|
||||
{
|
||||
}
|
||||
|
||||
nano::block_sideband::block_sideband (nano::account const & account_a, nano::block_hash const & successor_a, nano::amount const & balance_a, uint64_t const height_a, nano::seconds_t const timestamp_a, nano::epoch const epoch_a, bool const is_send, bool const is_receive, bool const is_epoch, nano::epoch const source_epoch_a) :
|
||||
successor (successor_a),
|
||||
account (account_a),
|
||||
balance (balance_a),
|
||||
height (height_a),
|
||||
timestamp (timestamp_a),
|
||||
details (epoch_a, is_send, is_receive, is_epoch),
|
||||
source_epoch (source_epoch_a)
|
||||
{
|
||||
}
|
||||
|
||||
size_t nano::block_sideband::size (nano::block_type type_a)
|
||||
{
|
||||
size_t result (0);
|
||||
result += sizeof (successor);
|
||||
if (type_a != nano::block_type::state && type_a != nano::block_type::open)
|
||||
{
|
||||
result += sizeof (account);
|
||||
}
|
||||
if (type_a != nano::block_type::open)
|
||||
{
|
||||
result += sizeof (height);
|
||||
}
|
||||
if (type_a == nano::block_type::receive || type_a == nano::block_type::change || type_a == nano::block_type::open)
|
||||
{
|
||||
result += sizeof (balance);
|
||||
}
|
||||
result += sizeof (timestamp);
|
||||
if (type_a == nano::block_type::state)
|
||||
{
|
||||
static_assert (sizeof (nano::epoch) == nano::block_details::size (), "block_details is larger than the epoch enum");
|
||||
result += nano::block_details::size () + sizeof (nano::epoch);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
void nano::block_sideband::serialize (nano::stream & stream_a, nano::block_type type_a) const
|
||||
{
|
||||
nano::write (stream_a, successor.bytes);
|
||||
if (type_a != nano::block_type::state && type_a != nano::block_type::open)
|
||||
{
|
||||
nano::write (stream_a, account.bytes);
|
||||
}
|
||||
if (type_a != nano::block_type::open)
|
||||
{
|
||||
nano::write (stream_a, boost::endian::native_to_big (height));
|
||||
}
|
||||
if (type_a == nano::block_type::receive || type_a == nano::block_type::change || type_a == nano::block_type::open)
|
||||
{
|
||||
nano::write (stream_a, balance.bytes);
|
||||
}
|
||||
nano::write (stream_a, boost::endian::native_to_big (timestamp));
|
||||
if (type_a == nano::block_type::state)
|
||||
{
|
||||
details.serialize (stream_a);
|
||||
nano::write (stream_a, static_cast<uint8_t> (source_epoch));
|
||||
}
|
||||
}
|
||||
|
||||
bool nano::block_sideband::deserialize (nano::stream & stream_a, nano::block_type type_a)
|
||||
{
|
||||
bool result (false);
|
||||
try
|
||||
{
|
||||
nano::read (stream_a, successor.bytes);
|
||||
if (type_a != nano::block_type::state && type_a != nano::block_type::open)
|
||||
{
|
||||
nano::read (stream_a, account.bytes);
|
||||
}
|
||||
if (type_a != nano::block_type::open)
|
||||
{
|
||||
nano::read (stream_a, height);
|
||||
boost::endian::big_to_native_inplace (height);
|
||||
}
|
||||
else
|
||||
{
|
||||
height = 1;
|
||||
}
|
||||
if (type_a == nano::block_type::receive || type_a == nano::block_type::change || type_a == nano::block_type::open)
|
||||
{
|
||||
nano::read (stream_a, balance.bytes);
|
||||
}
|
||||
nano::read (stream_a, timestamp);
|
||||
boost::endian::big_to_native_inplace (timestamp);
|
||||
if (type_a == nano::block_type::state)
|
||||
{
|
||||
result = details.deserialize (stream_a);
|
||||
uint8_t source_epoch_uint8_t{ 0 };
|
||||
nano::read (stream_a, source_epoch_uint8_t);
|
||||
source_epoch = static_cast<nano::epoch> (source_epoch_uint8_t);
|
||||
}
|
||||
}
|
||||
catch (std::runtime_error &)
|
||||
{
|
||||
result = true;
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
void nano::block_sideband::operator() (nano::object_stream & obs) const
|
||||
{
|
||||
obs.write ("successor", successor);
|
||||
obs.write ("account", account);
|
||||
obs.write ("balance", balance);
|
||||
obs.write ("height", height);
|
||||
obs.write ("timestamp", timestamp);
|
||||
obs.write ("source_epoch", source_epoch);
|
||||
obs.write ("details", details);
|
||||
}
|
||||
|
|
@ -1,19 +1,13 @@
|
|||
#pragma once
|
||||
|
||||
#include <nano/lib/block_type.hpp>
|
||||
#include <nano/lib/epoch.hpp>
|
||||
#include <nano/lib/fwd.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
|
||||
|
|
|
|||
|
|
@ -5,8 +5,3 @@ std::string_view nano::to_string (nano::block_type type)
|
|||
{
|
||||
return nano::enum_util::name (type);
|
||||
}
|
||||
|
||||
void nano::serialize_block_type (nano::stream & stream, const nano::block_type & type)
|
||||
{
|
||||
nano::write (stream, type);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,7 +1,5 @@
|
|||
#pragma once
|
||||
|
||||
#include <nano/lib/stream.hpp>
|
||||
|
||||
#include <cstdint>
|
||||
#include <string>
|
||||
|
||||
|
|
@ -19,8 +17,4 @@ enum class block_type : uint8_t
|
|||
};
|
||||
|
||||
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
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
#pragma once
|
||||
|
||||
#include <nano/lib/numbers.hpp>
|
||||
#include <nano/lib/numbers_templ.hpp>
|
||||
#include <nano/lib/uniquer.hpp>
|
||||
|
||||
namespace nano
|
||||
|
|
|
|||
|
|
@ -1,9 +1,13 @@
|
|||
#include <nano/crypto_lib/random_pool.hpp>
|
||||
#include <nano/lib/block_type.hpp>
|
||||
#include <nano/lib/block_uniquer.hpp>
|
||||
#include <nano/lib/blocks.hpp>
|
||||
#include <nano/lib/enum_util.hpp>
|
||||
#include <nano/lib/memory.hpp>
|
||||
#include <nano/lib/numbers.hpp>
|
||||
#include <nano/lib/stream.hpp>
|
||||
#include <nano/lib/threading.hpp>
|
||||
#include <nano/lib/work_version.hpp>
|
||||
#include <nano/secure/common.hpp>
|
||||
|
||||
#include <boost/endian/conversion.hpp>
|
||||
|
|
@ -1582,7 +1586,7 @@ std::shared_ptr<nano::block> nano::deserialize_block_json (boost::property_tree:
|
|||
|
||||
void nano::serialize_block (nano::stream & stream_a, nano::block const & block_a)
|
||||
{
|
||||
nano::serialize_block_type (stream_a, block_a.type ());
|
||||
nano::write (stream_a, block_a.type ());
|
||||
block_a.serialize (stream_a);
|
||||
}
|
||||
|
||||
|
|
@ -1908,213 +1912,3 @@ void nano::receive_block::operator() (nano::object_stream & obs) const
|
|||
obs.write ("signature", signature);
|
||||
obs.write ("work", work);
|
||||
}
|
||||
|
||||
/*
|
||||
* block_details
|
||||
*/
|
||||
|
||||
nano::block_details::block_details (nano::epoch const epoch_a, bool const is_send_a, bool const is_receive_a, bool const is_epoch_a) :
|
||||
epoch (epoch_a), is_send (is_send_a), is_receive (is_receive_a), is_epoch (is_epoch_a)
|
||||
{
|
||||
}
|
||||
|
||||
bool nano::block_details::operator== (nano::block_details const & other_a) const
|
||||
{
|
||||
return epoch == other_a.epoch && is_send == other_a.is_send && is_receive == other_a.is_receive && is_epoch == other_a.is_epoch;
|
||||
}
|
||||
|
||||
uint8_t nano::block_details::packed () const
|
||||
{
|
||||
std::bitset<8> result (static_cast<uint8_t> (epoch));
|
||||
result.set (7, is_send);
|
||||
result.set (6, is_receive);
|
||||
result.set (5, is_epoch);
|
||||
return static_cast<uint8_t> (result.to_ulong ());
|
||||
}
|
||||
|
||||
void nano::block_details::unpack (uint8_t details_a)
|
||||
{
|
||||
constexpr std::bitset<8> epoch_mask{ 0b00011111 };
|
||||
auto as_bitset = static_cast<std::bitset<8>> (details_a);
|
||||
is_send = as_bitset.test (7);
|
||||
is_receive = as_bitset.test (6);
|
||||
is_epoch = as_bitset.test (5);
|
||||
epoch = static_cast<nano::epoch> ((as_bitset & epoch_mask).to_ulong ());
|
||||
}
|
||||
|
||||
void nano::block_details::serialize (nano::stream & stream_a) const
|
||||
{
|
||||
nano::write (stream_a, packed ());
|
||||
}
|
||||
|
||||
bool nano::block_details::deserialize (nano::stream & stream_a)
|
||||
{
|
||||
bool result (false);
|
||||
try
|
||||
{
|
||||
uint8_t packed{ 0 };
|
||||
nano::read (stream_a, packed);
|
||||
unpack (packed);
|
||||
}
|
||||
catch (std::runtime_error &)
|
||||
{
|
||||
result = true;
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
void nano::block_details::operator() (nano::object_stream & obs) const
|
||||
{
|
||||
obs.write ("epoch", epoch);
|
||||
obs.write ("is_send", is_send);
|
||||
obs.write ("is_receive", is_receive);
|
||||
obs.write ("is_epoch", is_epoch);
|
||||
}
|
||||
|
||||
std::string nano::state_subtype (nano::block_details const details_a)
|
||||
{
|
||||
debug_assert (details_a.is_epoch + details_a.is_receive + details_a.is_send <= 1);
|
||||
if (details_a.is_send)
|
||||
{
|
||||
return "send";
|
||||
}
|
||||
else if (details_a.is_receive)
|
||||
{
|
||||
return "receive";
|
||||
}
|
||||
else if (details_a.is_epoch)
|
||||
{
|
||||
return "epoch";
|
||||
}
|
||||
else
|
||||
{
|
||||
return "change";
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* block_sideband
|
||||
*/
|
||||
|
||||
nano::block_sideband::block_sideband (nano::account const & account_a, nano::block_hash const & successor_a, nano::amount const & balance_a, uint64_t const height_a, nano::seconds_t const timestamp_a, nano::block_details const & details_a, nano::epoch const source_epoch_a) :
|
||||
successor (successor_a),
|
||||
account (account_a),
|
||||
balance (balance_a),
|
||||
height (height_a),
|
||||
timestamp (timestamp_a),
|
||||
details (details_a),
|
||||
source_epoch (source_epoch_a)
|
||||
{
|
||||
}
|
||||
|
||||
nano::block_sideband::block_sideband (nano::account const & account_a, nano::block_hash const & successor_a, nano::amount const & balance_a, uint64_t const height_a, nano::seconds_t const timestamp_a, nano::epoch const epoch_a, bool const is_send, bool const is_receive, bool const is_epoch, nano::epoch const source_epoch_a) :
|
||||
successor (successor_a),
|
||||
account (account_a),
|
||||
balance (balance_a),
|
||||
height (height_a),
|
||||
timestamp (timestamp_a),
|
||||
details (epoch_a, is_send, is_receive, is_epoch),
|
||||
source_epoch (source_epoch_a)
|
||||
{
|
||||
}
|
||||
|
||||
size_t nano::block_sideband::size (nano::block_type type_a)
|
||||
{
|
||||
size_t result (0);
|
||||
result += sizeof (successor);
|
||||
if (type_a != nano::block_type::state && type_a != nano::block_type::open)
|
||||
{
|
||||
result += sizeof (account);
|
||||
}
|
||||
if (type_a != nano::block_type::open)
|
||||
{
|
||||
result += sizeof (height);
|
||||
}
|
||||
if (type_a == nano::block_type::receive || type_a == nano::block_type::change || type_a == nano::block_type::open)
|
||||
{
|
||||
result += sizeof (balance);
|
||||
}
|
||||
result += sizeof (timestamp);
|
||||
if (type_a == nano::block_type::state)
|
||||
{
|
||||
static_assert (sizeof (nano::epoch) == nano::block_details::size (), "block_details is larger than the epoch enum");
|
||||
result += nano::block_details::size () + sizeof (nano::epoch);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
void nano::block_sideband::serialize (nano::stream & stream_a, nano::block_type type_a) const
|
||||
{
|
||||
nano::write (stream_a, successor.bytes);
|
||||
if (type_a != nano::block_type::state && type_a != nano::block_type::open)
|
||||
{
|
||||
nano::write (stream_a, account.bytes);
|
||||
}
|
||||
if (type_a != nano::block_type::open)
|
||||
{
|
||||
nano::write (stream_a, boost::endian::native_to_big (height));
|
||||
}
|
||||
if (type_a == nano::block_type::receive || type_a == nano::block_type::change || type_a == nano::block_type::open)
|
||||
{
|
||||
nano::write (stream_a, balance.bytes);
|
||||
}
|
||||
nano::write (stream_a, boost::endian::native_to_big (timestamp));
|
||||
if (type_a == nano::block_type::state)
|
||||
{
|
||||
details.serialize (stream_a);
|
||||
nano::write (stream_a, static_cast<uint8_t> (source_epoch));
|
||||
}
|
||||
}
|
||||
|
||||
bool nano::block_sideband::deserialize (nano::stream & stream_a, nano::block_type type_a)
|
||||
{
|
||||
bool result (false);
|
||||
try
|
||||
{
|
||||
nano::read (stream_a, successor.bytes);
|
||||
if (type_a != nano::block_type::state && type_a != nano::block_type::open)
|
||||
{
|
||||
nano::read (stream_a, account.bytes);
|
||||
}
|
||||
if (type_a != nano::block_type::open)
|
||||
{
|
||||
nano::read (stream_a, height);
|
||||
boost::endian::big_to_native_inplace (height);
|
||||
}
|
||||
else
|
||||
{
|
||||
height = 1;
|
||||
}
|
||||
if (type_a == nano::block_type::receive || type_a == nano::block_type::change || type_a == nano::block_type::open)
|
||||
{
|
||||
nano::read (stream_a, balance.bytes);
|
||||
}
|
||||
nano::read (stream_a, timestamp);
|
||||
boost::endian::big_to_native_inplace (timestamp);
|
||||
if (type_a == nano::block_type::state)
|
||||
{
|
||||
result = details.deserialize (stream_a);
|
||||
uint8_t source_epoch_uint8_t{ 0 };
|
||||
nano::read (stream_a, source_epoch_uint8_t);
|
||||
source_epoch = static_cast<nano::epoch> (source_epoch_uint8_t);
|
||||
}
|
||||
}
|
||||
catch (std::runtime_error &)
|
||||
{
|
||||
result = true;
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
void nano::block_sideband::operator() (nano::object_stream & obs) const
|
||||
{
|
||||
obs.write ("successor", successor);
|
||||
obs.write ("account", account);
|
||||
obs.write ("balance", balance);
|
||||
obs.write ("height", height);
|
||||
obs.write ("timestamp", timestamp);
|
||||
obs.write ("source_epoch", source_epoch);
|
||||
obs.write ("details", details);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,24 +1,25 @@
|
|||
#pragma once
|
||||
|
||||
#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/fwd.hpp>
|
||||
#include <nano/lib/numbers.hpp>
|
||||
#include <nano/lib/optional_ptr.hpp>
|
||||
#include <nano/lib/stream.hpp>
|
||||
|
||||
#include <boost/property_tree/ptree_fwd.hpp>
|
||||
|
||||
#include <optional>
|
||||
|
||||
typedef struct blake2b_state__ blake2b_state;
|
||||
|
||||
namespace nano
|
||||
{
|
||||
class block_visitor;
|
||||
class mutable_block_visitor;
|
||||
class object_stream;
|
||||
using block_uniquer = uniquer<nano::uint256_union, nano::block>;
|
||||
}
|
||||
|
||||
namespace nano
|
||||
{
|
||||
class block
|
||||
{
|
||||
public:
|
||||
|
|
|
|||
|
|
@ -1,9 +1,14 @@
|
|||
#pragma once
|
||||
|
||||
#include <nano/boost/asio/ip/tcp.hpp>
|
||||
namespace boost::asio::ip
|
||||
{
|
||||
class tcp;
|
||||
template <typename InternetProtocol>
|
||||
class basic_endpoint;
|
||||
}
|
||||
|
||||
namespace nano
|
||||
{
|
||||
using endpoint = boost::asio::ip::tcp::endpoint;
|
||||
using endpoint = boost::asio::ip::basic_endpoint<boost::asio::ip::tcp>;
|
||||
using tcp_endpoint = endpoint;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,8 +1,10 @@
|
|||
#include <nano/crypto/blake2/blake2.h>
|
||||
#include <nano/lib/block_type.hpp>
|
||||
#include <nano/lib/blocks.hpp>
|
||||
#include <nano/lib/config.hpp>
|
||||
#include <nano/lib/env.hpp>
|
||||
#include <nano/lib/logging.hpp>
|
||||
#include <nano/lib/work_version.hpp>
|
||||
|
||||
#include <boost/format.hpp>
|
||||
#include <boost/lexical_cast.hpp>
|
||||
|
|
|
|||
|
|
@ -105,15 +105,11 @@ enum class networks : uint16_t
|
|||
|
||||
std::string_view to_string (nano::networks);
|
||||
|
||||
enum class work_version
|
||||
{
|
||||
unspecified,
|
||||
work_1
|
||||
};
|
||||
enum class block_type : uint8_t;
|
||||
class root;
|
||||
class block;
|
||||
class block_details;
|
||||
enum class work_version;
|
||||
|
||||
class work_thresholds
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1,43 +1,6 @@
|
|||
#include <nano/lib/epoch.hpp>
|
||||
#include <nano/lib/utility.hpp>
|
||||
|
||||
#include <algorithm>
|
||||
|
||||
nano::link const & nano::epochs::link (nano::epoch epoch_a) const
|
||||
{
|
||||
return epochs_m.at (epoch_a).link;
|
||||
}
|
||||
|
||||
bool nano::epochs::is_epoch_link (nano::link const & link_a) const
|
||||
{
|
||||
return std::any_of (epochs_m.begin (), epochs_m.end (), [&link_a] (auto const & item_a) { return item_a.second.link == link_a; });
|
||||
}
|
||||
|
||||
nano::public_key const & nano::epochs::signer (nano::epoch epoch_a) const
|
||||
{
|
||||
return epochs_m.at (epoch_a).signer;
|
||||
}
|
||||
|
||||
nano::epoch nano::epochs::epoch (nano::link const & link_a) const
|
||||
{
|
||||
auto existing (std::find_if (epochs_m.begin (), epochs_m.end (), [&link_a] (auto const & item_a) { return item_a.second.link == link_a; }));
|
||||
debug_assert (existing != epochs_m.end ());
|
||||
return existing->first;
|
||||
}
|
||||
|
||||
void nano::epochs::add (nano::epoch epoch_a, nano::public_key const & signer_a, nano::link const & link_a)
|
||||
{
|
||||
debug_assert (epochs_m.find (epoch_a) == epochs_m.end ());
|
||||
epochs_m[epoch_a] = { signer_a, link_a };
|
||||
}
|
||||
|
||||
bool nano::epochs::is_sequential (nano::epoch epoch_a, nano::epoch new_epoch_a)
|
||||
{
|
||||
auto head_epoch = std::underlying_type_t<nano::epoch> (epoch_a);
|
||||
bool is_valid_epoch (head_epoch >= std::underlying_type_t<nano::epoch> (nano::epoch::epoch_0));
|
||||
return is_valid_epoch && (std::underlying_type_t<nano::epoch> (new_epoch_a) == (head_epoch + 1));
|
||||
}
|
||||
|
||||
std::underlying_type_t<nano::epoch> nano::normalized_epoch (nano::epoch epoch_a)
|
||||
{
|
||||
// Currently assumes that the epoch versions in the enum are sequential.
|
||||
|
|
|
|||
|
|
@ -1,9 +1,8 @@
|
|||
#pragma once
|
||||
|
||||
#include <nano/lib/numbers.hpp>
|
||||
|
||||
#include <cstdint>
|
||||
#include <functional>
|
||||
#include <type_traits>
|
||||
#include <unordered_map>
|
||||
|
||||
namespace nano
|
||||
{
|
||||
|
|
@ -31,42 +30,7 @@ struct hash<::nano::epoch>
|
|||
{
|
||||
std::size_t operator() (::nano::epoch const & epoch_a) const
|
||||
{
|
||||
std::hash<std::underlying_type_t<::nano::epoch>> hash;
|
||||
return hash (static_cast<std::underlying_type_t<::nano::epoch>> (epoch_a));
|
||||
return std::underlying_type_t<::nano::epoch> (epoch_a);
|
||||
}
|
||||
};
|
||||
}
|
||||
namespace nano
|
||||
{
|
||||
class epoch_info
|
||||
{
|
||||
public:
|
||||
nano::public_key signer;
|
||||
nano::link link;
|
||||
};
|
||||
class epochs
|
||||
{
|
||||
public:
|
||||
/** Returns true if link matches one of the released epoch links.
|
||||
* WARNING: just because a legal block contains an epoch link, it does not mean it is an epoch block.
|
||||
* A legal block containing an epoch link can easily be constructed by sending to an address identical
|
||||
* to one of the epoch links.
|
||||
* Epoch blocks follow the following rules and a block must satisfy them all to be a true epoch block:
|
||||
* epoch blocks are always state blocks
|
||||
* epoch blocks never change the balance of an account
|
||||
* epoch blocks always have a link field that starts with the ascii bytes "epoch v1 block" or "epoch v2 block" (and possibly others in the future)
|
||||
* epoch blocks never change the representative
|
||||
* epoch blocks are not signed by the account key, they are signed either by genesis or by special epoch keys
|
||||
*/
|
||||
bool is_epoch_link (nano::link const & link_a) const;
|
||||
nano::link const & link (nano::epoch epoch_a) const;
|
||||
nano::public_key const & signer (nano::epoch epoch_a) const;
|
||||
nano::epoch epoch (nano::link const & link_a) const;
|
||||
void add (nano::epoch epoch_a, nano::public_key const & signer_a, nano::link const & link_a);
|
||||
/** Checks that new_epoch is 1 version higher than epoch */
|
||||
static bool is_sequential (nano::epoch epoch_a, nano::epoch new_epoch_a);
|
||||
|
||||
private:
|
||||
std::unordered_map<nano::epoch, nano::epoch_info> epochs_m;
|
||||
};
|
||||
}
|
||||
|
|
|
|||
39
nano/lib/epochs.cpp
Normal file
39
nano/lib/epochs.cpp
Normal file
|
|
@ -0,0 +1,39 @@
|
|||
#include <nano/lib/epochs.hpp>
|
||||
#include <nano/lib/utility.hpp>
|
||||
|
||||
#include <algorithm>
|
||||
|
||||
nano::link const & nano::epochs::link (nano::epoch epoch_a) const
|
||||
{
|
||||
return epochs_m.at (epoch_a).link;
|
||||
}
|
||||
|
||||
bool nano::epochs::is_epoch_link (nano::link const & link_a) const
|
||||
{
|
||||
return std::any_of (epochs_m.begin (), epochs_m.end (), [&link_a] (auto const & item_a) { return item_a.second.link == link_a; });
|
||||
}
|
||||
|
||||
nano::public_key const & nano::epochs::signer (nano::epoch epoch_a) const
|
||||
{
|
||||
return epochs_m.at (epoch_a).signer;
|
||||
}
|
||||
|
||||
nano::epoch nano::epochs::epoch (nano::link const & link_a) const
|
||||
{
|
||||
auto existing (std::find_if (epochs_m.begin (), epochs_m.end (), [&link_a] (auto const & item_a) { return item_a.second.link == link_a; }));
|
||||
debug_assert (existing != epochs_m.end ());
|
||||
return existing->first;
|
||||
}
|
||||
|
||||
void nano::epochs::add (nano::epoch epoch_a, nano::public_key const & signer_a, nano::link const & link_a)
|
||||
{
|
||||
debug_assert (epochs_m.find (epoch_a) == epochs_m.end ());
|
||||
epochs_m[epoch_a] = { signer_a, link_a };
|
||||
}
|
||||
|
||||
bool nano::epochs::is_sequential (nano::epoch epoch_a, nano::epoch new_epoch_a)
|
||||
{
|
||||
auto head_epoch = std::underlying_type_t<nano::epoch> (epoch_a);
|
||||
bool is_valid_epoch (head_epoch >= std::underlying_type_t<nano::epoch> (nano::epoch::epoch_0));
|
||||
return is_valid_epoch && (std::underlying_type_t<nano::epoch> (new_epoch_a) == (head_epoch + 1));
|
||||
}
|
||||
42
nano/lib/epochs.hpp
Normal file
42
nano/lib/epochs.hpp
Normal file
|
|
@ -0,0 +1,42 @@
|
|||
#pragma once
|
||||
|
||||
#include <nano/lib/epoch.hpp>
|
||||
#include <nano/lib/numbers.hpp>
|
||||
|
||||
#include <cstdint>
|
||||
#include <unordered_map>
|
||||
|
||||
namespace nano
|
||||
{
|
||||
class epoch_info
|
||||
{
|
||||
public:
|
||||
nano::public_key signer;
|
||||
nano::link link;
|
||||
};
|
||||
class epochs
|
||||
{
|
||||
public:
|
||||
/** Returns true if link matches one of the released epoch links.
|
||||
* WARNING: just because a legal block contains an epoch link, it does not mean it is an epoch block.
|
||||
* A legal block containing an epoch link can easily be constructed by sending to an address identical
|
||||
* to one of the epoch links.
|
||||
* Epoch blocks follow the following rules and a block must satisfy them all to be a true epoch block:
|
||||
* epoch blocks are always state blocks
|
||||
* epoch blocks never change the balance of an account
|
||||
* epoch blocks always have a link field that starts with the ascii bytes "epoch v1 block" or "epoch v2 block" (and possibly others in the future)
|
||||
* epoch blocks never change the representative
|
||||
* epoch blocks are not signed by the account key, they are signed either by genesis or by special epoch keys
|
||||
*/
|
||||
bool is_epoch_link (nano::link const & link_a) const;
|
||||
nano::link const & link (nano::epoch epoch_a) const;
|
||||
nano::public_key const & signer (nano::epoch epoch_a) const;
|
||||
nano::epoch epoch (nano::link const & link_a) const;
|
||||
void add (nano::epoch epoch_a, nano::public_key const & signer_a, nano::link const & link_a);
|
||||
/** Checks that new_epoch is 1 version higher than epoch */
|
||||
static bool is_sequential (nano::epoch epoch_a, nano::epoch new_epoch_a);
|
||||
|
||||
private:
|
||||
std::unordered_map<nano::epoch, nano::epoch_info> epochs_m;
|
||||
};
|
||||
}
|
||||
31
nano/lib/fwd.hpp
Normal file
31
nano/lib/fwd.hpp
Normal file
|
|
@ -0,0 +1,31 @@
|
|||
#pragma once
|
||||
|
||||
#include <cstdint>
|
||||
#include <iosfwd>
|
||||
|
||||
struct uint8_char_traits;
|
||||
namespace nano
|
||||
{
|
||||
class block;
|
||||
enum class block_type : uint8_t;
|
||||
class block_visitor;
|
||||
class container_info;
|
||||
enum class epoch : uint8_t;
|
||||
class jsonconfig;
|
||||
class mutable_block_visitor;
|
||||
class network_constants;
|
||||
class object_stream;
|
||||
class thread_pool;
|
||||
class tomlconfig;
|
||||
template <typename Key, typename Value>
|
||||
class uniquer;
|
||||
enum class work_version;
|
||||
|
||||
using stream = std::basic_streambuf<uint8_t, uint8_char_traits>;
|
||||
}
|
||||
|
||||
namespace nano::stat
|
||||
{
|
||||
enum class detail;
|
||||
enum class dir;
|
||||
}
|
||||
|
|
@ -48,6 +48,16 @@ private:
|
|||
std::vector<std::function<void ()>> cleanup_funcs;
|
||||
};
|
||||
|
||||
/** Helper guard which contains all the necessary purge (remove all memory even if used) functions */
|
||||
class node_singleton_memory_pool_purge_guard
|
||||
{
|
||||
public:
|
||||
node_singleton_memory_pool_purge_guard ();
|
||||
|
||||
private:
|
||||
nano::cleanup_guard cleanup_guard;
|
||||
};
|
||||
|
||||
template <typename T, typename... Args>
|
||||
std::shared_ptr<T> make_shared (Args &&... args)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#include <nano/lib/locks.hpp>
|
||||
#include <nano/lib/numbers.hpp>
|
||||
|
||||
#include <cryptopp/seckey.h>
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
#pragma once
|
||||
|
||||
#include <boost/functional/hash.hpp>
|
||||
#include <boost/functional/hash_fwd.hpp>
|
||||
#include <boost/multiprecision/cpp_int.hpp>
|
||||
|
||||
#include <array>
|
||||
|
|
@ -516,185 +516,53 @@ namespace difficulty
|
|||
namespace std
|
||||
{
|
||||
template <>
|
||||
struct hash<::nano::uint128_union>
|
||||
{
|
||||
size_t operator() (::nano::uint128_union const & value) const noexcept
|
||||
{
|
||||
return value.qwords[0] + value.qwords[1];
|
||||
}
|
||||
};
|
||||
struct hash<::nano::uint128_union>;
|
||||
template <>
|
||||
struct hash<::nano::uint256_union>
|
||||
{
|
||||
size_t operator() (::nano::uint256_union const & value) const noexcept
|
||||
{
|
||||
return value.qwords[0] + value.qwords[1] + value.qwords[2] + value.qwords[3];
|
||||
}
|
||||
};
|
||||
struct hash<::nano::uint256_union>;
|
||||
template <>
|
||||
struct hash<::nano::public_key>
|
||||
{
|
||||
size_t operator() (::nano::public_key const & value) const noexcept
|
||||
{
|
||||
return hash<::nano::uint256_union>{}(value);
|
||||
}
|
||||
};
|
||||
struct hash<::nano::public_key>;
|
||||
template <>
|
||||
struct hash<::nano::block_hash>
|
||||
{
|
||||
size_t operator() (::nano::block_hash const & value) const noexcept
|
||||
{
|
||||
return hash<::nano::uint256_union>{}(value);
|
||||
}
|
||||
};
|
||||
struct hash<::nano::block_hash>;
|
||||
template <>
|
||||
struct hash<::nano::hash_or_account>
|
||||
{
|
||||
size_t operator() (::nano::hash_or_account const & value) const noexcept
|
||||
{
|
||||
return hash<::nano::block_hash>{}(value.as_block_hash ());
|
||||
}
|
||||
};
|
||||
struct hash<::nano::hash_or_account>;
|
||||
template <>
|
||||
struct hash<::nano::root>
|
||||
{
|
||||
size_t operator() (::nano::root const & value) const noexcept
|
||||
{
|
||||
return hash<::nano::hash_or_account>{}(value);
|
||||
}
|
||||
};
|
||||
struct hash<::nano::root>;
|
||||
template <>
|
||||
struct hash<::nano::link>
|
||||
{
|
||||
size_t operator() (::nano::link const & value) const noexcept
|
||||
{
|
||||
return hash<::nano::hash_or_account>{}(value);
|
||||
}
|
||||
};
|
||||
struct hash<::nano::link>;
|
||||
template <>
|
||||
struct hash<::nano::raw_key>
|
||||
{
|
||||
size_t operator() (::nano::raw_key const & value) const noexcept
|
||||
{
|
||||
return hash<::nano::uint256_union>{}(value);
|
||||
}
|
||||
};
|
||||
struct hash<::nano::raw_key>;
|
||||
template <>
|
||||
struct hash<::nano::wallet_id>
|
||||
{
|
||||
size_t operator() (::nano::wallet_id const & value) const noexcept
|
||||
{
|
||||
return hash<::nano::uint256_union>{}(value);
|
||||
}
|
||||
};
|
||||
struct hash<::nano::wallet_id>;
|
||||
template <>
|
||||
struct hash<::nano::uint512_union>
|
||||
{
|
||||
size_t operator() (::nano::uint512_union const & value) const noexcept
|
||||
{
|
||||
return hash<::nano::uint256_union>{}(value.uint256s[0]) + hash<::nano::uint256_union> () (value.uint256s[1]);
|
||||
}
|
||||
};
|
||||
struct hash<::nano::uint512_union>;
|
||||
template <>
|
||||
struct hash<::nano::qualified_root>
|
||||
{
|
||||
size_t operator() (::nano::qualified_root const & value) const noexcept
|
||||
{
|
||||
return hash<::nano::uint512_union>{}(value);
|
||||
}
|
||||
};
|
||||
struct hash<::nano::qualified_root>;
|
||||
}
|
||||
|
||||
namespace boost
|
||||
{
|
||||
template <>
|
||||
struct hash<::nano::uint128_union>
|
||||
{
|
||||
size_t operator() (::nano::uint128_union const & value) const noexcept
|
||||
{
|
||||
return std::hash<::nano::uint128_union> () (value);
|
||||
}
|
||||
};
|
||||
struct hash<::nano::uint128_union>;
|
||||
template <>
|
||||
struct hash<::nano::uint256_union>
|
||||
{
|
||||
size_t operator() (::nano::uint256_union const & value) const noexcept
|
||||
{
|
||||
return std::hash<::nano::uint256_union> () (value);
|
||||
}
|
||||
};
|
||||
struct hash<::nano::uint256_union>;
|
||||
template <>
|
||||
struct hash<::nano::public_key>
|
||||
{
|
||||
size_t operator() (::nano::public_key const & value) const noexcept
|
||||
{
|
||||
return std::hash<::nano::public_key> () (value);
|
||||
}
|
||||
};
|
||||
struct hash<::nano::public_key>;
|
||||
template <>
|
||||
struct hash<::nano::block_hash>
|
||||
{
|
||||
size_t operator() (::nano::block_hash const & value) const noexcept
|
||||
{
|
||||
return std::hash<::nano::block_hash> () (value);
|
||||
}
|
||||
};
|
||||
struct hash<::nano::block_hash>;
|
||||
template <>
|
||||
struct hash<::nano::hash_or_account>
|
||||
{
|
||||
size_t operator() (::nano::hash_or_account const & value) const noexcept
|
||||
{
|
||||
return std::hash<::nano::hash_or_account> () (value);
|
||||
}
|
||||
};
|
||||
struct hash<::nano::hash_or_account>;
|
||||
template <>
|
||||
struct hash<::nano::root>
|
||||
{
|
||||
size_t operator() (::nano::root const & value) const noexcept
|
||||
{
|
||||
return std::hash<::nano::root> () (value);
|
||||
}
|
||||
};
|
||||
struct hash<::nano::root>;
|
||||
template <>
|
||||
struct hash<::nano::link>
|
||||
{
|
||||
size_t operator() (::nano::link const & value) const noexcept
|
||||
{
|
||||
return std::hash<::nano::link> () (value);
|
||||
}
|
||||
};
|
||||
struct hash<::nano::link>;
|
||||
template <>
|
||||
struct hash<::nano::raw_key>
|
||||
{
|
||||
size_t operator() (::nano::raw_key const & value) const noexcept
|
||||
{
|
||||
return std::hash<::nano::raw_key> () (value);
|
||||
}
|
||||
};
|
||||
struct hash<::nano::raw_key>;
|
||||
template <>
|
||||
struct hash<::nano::wallet_id>
|
||||
{
|
||||
size_t operator() (::nano::wallet_id const & value) const noexcept
|
||||
{
|
||||
return std::hash<::nano::wallet_id> () (value);
|
||||
}
|
||||
};
|
||||
struct hash<::nano::wallet_id>;
|
||||
template <>
|
||||
struct hash<::nano::uint512_union>
|
||||
{
|
||||
size_t operator() (::nano::uint512_union const & value) const noexcept
|
||||
{
|
||||
return std::hash<::nano::uint512_union> () (value);
|
||||
}
|
||||
};
|
||||
struct hash<::nano::uint512_union>;
|
||||
template <>
|
||||
struct hash<::nano::qualified_root>
|
||||
{
|
||||
size_t operator() (::nano::qualified_root const & value) const noexcept
|
||||
{
|
||||
return std::hash<::nano::qualified_root> () (value);
|
||||
}
|
||||
};
|
||||
struct hash<::nano::qualified_root>;
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
|
|||
189
nano/lib/numbers_templ.hpp
Normal file
189
nano/lib/numbers_templ.hpp
Normal file
|
|
@ -0,0 +1,189 @@
|
|||
#pragma once
|
||||
|
||||
#include <nano/lib/numbers.hpp>
|
||||
|
||||
#include <boost/functional/hash.hpp>
|
||||
|
||||
namespace std
|
||||
{
|
||||
template <>
|
||||
struct hash<::nano::uint128_union>
|
||||
{
|
||||
size_t operator() (::nano::uint128_union const & value) const noexcept
|
||||
{
|
||||
return value.qwords[0] + value.qwords[1];
|
||||
}
|
||||
};
|
||||
template <>
|
||||
struct hash<::nano::uint256_union>
|
||||
{
|
||||
size_t operator() (::nano::uint256_union const & value) const noexcept
|
||||
{
|
||||
return value.qwords[0] + value.qwords[1] + value.qwords[2] + value.qwords[3];
|
||||
}
|
||||
};
|
||||
template <>
|
||||
struct hash<::nano::public_key>
|
||||
{
|
||||
size_t operator() (::nano::public_key const & value) const noexcept
|
||||
{
|
||||
return hash<::nano::uint256_union>{}(value);
|
||||
}
|
||||
};
|
||||
template <>
|
||||
struct hash<::nano::block_hash>
|
||||
{
|
||||
size_t operator() (::nano::block_hash const & value) const noexcept
|
||||
{
|
||||
return hash<::nano::uint256_union>{}(value);
|
||||
}
|
||||
};
|
||||
template <>
|
||||
struct hash<::nano::hash_or_account>
|
||||
{
|
||||
size_t operator() (::nano::hash_or_account const & value) const noexcept
|
||||
{
|
||||
return hash<::nano::block_hash>{}(value.as_block_hash ());
|
||||
}
|
||||
};
|
||||
template <>
|
||||
struct hash<::nano::root>
|
||||
{
|
||||
size_t operator() (::nano::root const & value) const noexcept
|
||||
{
|
||||
return hash<::nano::hash_or_account>{}(value);
|
||||
}
|
||||
};
|
||||
template <>
|
||||
struct hash<::nano::link>
|
||||
{
|
||||
size_t operator() (::nano::link const & value) const noexcept
|
||||
{
|
||||
return hash<::nano::hash_or_account>{}(value);
|
||||
}
|
||||
};
|
||||
template <>
|
||||
struct hash<::nano::raw_key>
|
||||
{
|
||||
size_t operator() (::nano::raw_key const & value) const noexcept
|
||||
{
|
||||
return hash<::nano::uint256_union>{}(value);
|
||||
}
|
||||
};
|
||||
template <>
|
||||
struct hash<::nano::wallet_id>
|
||||
{
|
||||
size_t operator() (::nano::wallet_id const & value) const noexcept
|
||||
{
|
||||
return hash<::nano::uint256_union>{}(value);
|
||||
}
|
||||
};
|
||||
template <>
|
||||
struct hash<::nano::uint512_union>
|
||||
{
|
||||
size_t operator() (::nano::uint512_union const & value) const noexcept
|
||||
{
|
||||
return hash<::nano::uint256_union>{}(value.uint256s[0]) + hash<::nano::uint256_union> () (value.uint256s[1]);
|
||||
}
|
||||
};
|
||||
template <>
|
||||
struct hash<::nano::qualified_root>
|
||||
{
|
||||
size_t operator() (::nano::qualified_root const & value) const noexcept
|
||||
{
|
||||
return hash<::nano::uint512_union>{}(value);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
namespace boost
|
||||
{
|
||||
template <>
|
||||
struct hash<::nano::uint128_union>
|
||||
{
|
||||
size_t operator() (::nano::uint128_union const & value) const noexcept
|
||||
{
|
||||
return std::hash<::nano::uint128_union> () (value);
|
||||
}
|
||||
};
|
||||
template <>
|
||||
struct hash<::nano::uint256_union>
|
||||
{
|
||||
size_t operator() (::nano::uint256_union const & value) const noexcept
|
||||
{
|
||||
return std::hash<::nano::uint256_union> () (value);
|
||||
}
|
||||
};
|
||||
template <>
|
||||
struct hash<::nano::public_key>
|
||||
{
|
||||
size_t operator() (::nano::public_key const & value) const noexcept
|
||||
{
|
||||
return std::hash<::nano::public_key> () (value);
|
||||
}
|
||||
};
|
||||
template <>
|
||||
struct hash<::nano::block_hash>
|
||||
{
|
||||
size_t operator() (::nano::block_hash const & value) const noexcept
|
||||
{
|
||||
return std::hash<::nano::block_hash> () (value);
|
||||
}
|
||||
};
|
||||
template <>
|
||||
struct hash<::nano::hash_or_account>
|
||||
{
|
||||
size_t operator() (::nano::hash_or_account const & value) const noexcept
|
||||
{
|
||||
return std::hash<::nano::hash_or_account> () (value);
|
||||
}
|
||||
};
|
||||
template <>
|
||||
struct hash<::nano::root>
|
||||
{
|
||||
size_t operator() (::nano::root const & value) const noexcept
|
||||
{
|
||||
return std::hash<::nano::root> () (value);
|
||||
}
|
||||
};
|
||||
template <>
|
||||
struct hash<::nano::link>
|
||||
{
|
||||
size_t operator() (::nano::link const & value) const noexcept
|
||||
{
|
||||
return std::hash<::nano::link> () (value);
|
||||
}
|
||||
};
|
||||
template <>
|
||||
struct hash<::nano::raw_key>
|
||||
{
|
||||
size_t operator() (::nano::raw_key const & value) const noexcept
|
||||
{
|
||||
return std::hash<::nano::raw_key> () (value);
|
||||
}
|
||||
};
|
||||
template <>
|
||||
struct hash<::nano::wallet_id>
|
||||
{
|
||||
size_t operator() (::nano::wallet_id const & value) const noexcept
|
||||
{
|
||||
return std::hash<::nano::wallet_id> () (value);
|
||||
}
|
||||
};
|
||||
template <>
|
||||
struct hash<::nano::uint512_union>
|
||||
{
|
||||
size_t operator() (::nano::uint512_union const & value) const noexcept
|
||||
{
|
||||
return std::hash<::nano::uint512_union> () (value);
|
||||
}
|
||||
};
|
||||
template <>
|
||||
struct hash<::nano::qualified_root>
|
||||
{
|
||||
size_t operator() (::nano::qualified_root const & value) const noexcept
|
||||
{
|
||||
return std::hash<::nano::qualified_root> () (value);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
|
@ -1,7 +1,5 @@
|
|||
#pragma once
|
||||
|
||||
#include <nano/lib/utility.hpp>
|
||||
|
||||
#include <cstddef>
|
||||
#include <memory>
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,7 @@
|
|||
#pragma once
|
||||
|
||||
#include <nano/lib/locks.hpp>
|
||||
|
||||
#include <algorithm>
|
||||
#include <chrono>
|
||||
#include <mutex>
|
||||
|
|
@ -73,4 +75,4 @@ private:
|
|||
nano::rate::token_bucket bucket;
|
||||
mutable nano::mutex mutex;
|
||||
};
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@
|
|||
#include <nano/lib/thread_roles.hpp>
|
||||
#include <nano/lib/threading.hpp>
|
||||
#include <nano/lib/work.hpp>
|
||||
#include <nano/lib/work_version.hpp>
|
||||
#include <nano/node/xorshift.hpp>
|
||||
|
||||
#include <future>
|
||||
|
|
@ -41,7 +42,7 @@ nano::work_pool::work_pool (nano::network_constants & network_constants, unsigne
|
|||
}
|
||||
for (auto i (0u); i < count; ++i)
|
||||
{
|
||||
threads.emplace_back (nano::thread_attributes::get_default (), [this, i] () {
|
||||
threads.emplace_back ([this, i] () {
|
||||
nano::thread_role::set (nano::thread_role::name::work);
|
||||
nano::work_thread_reprioritize ();
|
||||
loop (i);
|
||||
|
|
@ -240,4 +241,4 @@ nano::container_info nano::work_pool::container_info () const
|
|||
info.put ("pending", pending);
|
||||
info.add ("work_observers", work_observers.container_info ());
|
||||
return info;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -8,10 +8,10 @@
|
|||
#include <nano/node/openclwork.hpp>
|
||||
|
||||
#include <boost/optional.hpp>
|
||||
#include <boost/thread/thread.hpp>
|
||||
|
||||
#include <atomic>
|
||||
#include <memory>
|
||||
#include <thread>
|
||||
|
||||
namespace nano
|
||||
{
|
||||
|
|
@ -54,7 +54,7 @@ public:
|
|||
nano::network_constants & network_constants;
|
||||
std::atomic<int> ticket;
|
||||
bool done;
|
||||
std::vector<boost::thread> threads;
|
||||
std::vector<std::thread> threads;
|
||||
std::list<nano::work_item> pending;
|
||||
mutable nano::mutex mutex{ mutex_identifier (mutexes::work_pool) };
|
||||
nano::condition_variable producer_condition;
|
||||
|
|
|
|||
10
nano/lib/work_version.hpp
Normal file
10
nano/lib/work_version.hpp
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
#pragma once
|
||||
|
||||
namespace nano
|
||||
{
|
||||
enum class work_version
|
||||
{
|
||||
unspecified,
|
||||
work_1
|
||||
};
|
||||
}
|
||||
|
|
@ -1,8 +1,10 @@
|
|||
#include <nano/crypto_lib/random_pool.hpp>
|
||||
#include <nano/lib/block_type.hpp>
|
||||
#include <nano/lib/blocks.hpp>
|
||||
#include <nano/lib/cli.hpp>
|
||||
#include <nano/lib/thread_runner.hpp>
|
||||
#include <nano/lib/utility.hpp>
|
||||
#include <nano/lib/work_version.hpp>
|
||||
#include <nano/nano_node/daemon.hpp>
|
||||
#include <nano/node/active_elections.hpp>
|
||||
#include <nano/node/cli.hpp>
|
||||
|
|
@ -15,6 +17,7 @@
|
|||
#include <nano/node/transport/inproc.hpp>
|
||||
#include <nano/secure/ledger.hpp>
|
||||
#include <nano/secure/ledger_set_any.hpp>
|
||||
#include <nano/secure/vote.hpp>
|
||||
#include <nano/store/pending.hpp>
|
||||
|
||||
#include <boost/dll/runtime_symbol_info.hpp>
|
||||
|
|
|
|||
|
|
@ -43,8 +43,6 @@ add_library(
|
|||
bootstrap/peer_scoring.cpp
|
||||
cli.hpp
|
||||
cli.cpp
|
||||
common.hpp
|
||||
common.cpp
|
||||
confirming_set.hpp
|
||||
confirming_set.cpp
|
||||
confirmation_solicitor.hpp
|
||||
|
|
@ -60,9 +58,13 @@ add_library(
|
|||
election_behavior.hpp
|
||||
election_insertion_result.hpp
|
||||
election_status.hpp
|
||||
endpoint.cpp
|
||||
endpoint.hpp
|
||||
endpoint_templ.hpp
|
||||
epoch_upgrader.hpp
|
||||
epoch_upgrader.cpp
|
||||
fair_queue.hpp
|
||||
fwd.hpp
|
||||
ipc/action_handler.hpp
|
||||
ipc/action_handler.cpp
|
||||
ipc/flatbuffers_handler.hpp
|
||||
|
|
@ -151,6 +153,7 @@ add_library(
|
|||
transport/tcp_channel.cpp
|
||||
transport/fake.hpp
|
||||
transport/fake.cpp
|
||||
transport/fwd.hpp
|
||||
transport/inproc.hpp
|
||||
transport/inproc.cpp
|
||||
transport/message_deserializer.hpp
|
||||
|
|
|
|||
|
|
@ -1,3 +1,4 @@
|
|||
#include <nano/lib/block_type.hpp>
|
||||
#include <nano/lib/blocks.hpp>
|
||||
#include <nano/lib/enum_util.hpp>
|
||||
#include <nano/lib/numbers.hpp>
|
||||
|
|
@ -624,4 +625,4 @@ nano::stat::type nano::to_stat_type (nano::election_state state)
|
|||
nano::stat::detail nano::to_stat_detail (nano::election_status_type type)
|
||||
{
|
||||
return nano::enum_util::cast<nano::stat::detail> (type);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -50,4 +50,4 @@ private:
|
|||
nano::rate_limiter limiter_generic;
|
||||
nano::rate_limiter limiter_bootstrap;
|
||||
};
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,3 +1,4 @@
|
|||
#include <nano/lib/block_type.hpp>
|
||||
#include <nano/lib/blocks.hpp>
|
||||
#include <nano/lib/enum_util.hpp>
|
||||
#include <nano/lib/threading.hpp>
|
||||
|
|
@ -518,4 +519,4 @@ std::string_view nano::to_string (nano::block_source source)
|
|||
nano::stat::detail nano::to_stat_detail (nano::block_source type)
|
||||
{
|
||||
return nano::enum_util::cast<nano::stat::detail> (type);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,6 +3,8 @@
|
|||
#include <nano/node/bootstrap/account_sets.hpp>
|
||||
#include <nano/node/bootstrap/bootstrap_config.hpp>
|
||||
|
||||
#include <boost/range/iterator_range.hpp>
|
||||
|
||||
#include <algorithm>
|
||||
#include <memory>
|
||||
#include <vector>
|
||||
|
|
@ -354,4 +356,4 @@ nano::container_info nano::bootstrap::account_sets::container_info () const
|
|||
info.put ("blocking", blocking);
|
||||
info.put ("blocking_unknown", blocking_unknown);
|
||||
return info;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -19,8 +19,6 @@ namespace mi = boost::multi_index;
|
|||
|
||||
namespace nano
|
||||
{
|
||||
class stats;
|
||||
|
||||
namespace bootstrap
|
||||
{
|
||||
/** This class tracks accounts various account sets which are shared among the multiple bootstrap threads */
|
||||
|
|
@ -162,4 +160,4 @@ namespace bootstrap
|
|||
info_t info () const;
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,3 +1,4 @@
|
|||
#include <nano/lib/block_type.hpp>
|
||||
#include <nano/lib/blocks.hpp>
|
||||
#include <nano/lib/enum_util.hpp>
|
||||
#include <nano/lib/stats_enums.hpp>
|
||||
|
|
@ -1108,4 +1109,4 @@ nano::container_info nano::bootstrap_service::container_info () const
|
|||
nano::stat::detail nano::to_stat_detail (nano::bootstrap_service::query_type type)
|
||||
{
|
||||
return nano::enum_util::cast<nano::stat::detail> (type);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,8 +2,8 @@
|
|||
#include <nano/lib/cli.hpp>
|
||||
#include <nano/lib/tomlconfig.hpp>
|
||||
#include <nano/node/cli.hpp>
|
||||
#include <nano/node/common.hpp>
|
||||
#include <nano/node/daemonconfig.hpp>
|
||||
#include <nano/node/endpoint.hpp>
|
||||
#include <nano/node/inactive_node.hpp>
|
||||
#include <nano/node/node.hpp>
|
||||
#include <nano/secure/ledger.hpp>
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
#include <nano/lib/logging.hpp>
|
||||
#include <nano/lib/stats.hpp>
|
||||
#include <nano/lib/thread_roles.hpp>
|
||||
#include <nano/node/confirming_set.hpp>
|
||||
#include <nano/secure/ledger.hpp>
|
||||
|
|
|
|||
|
|
@ -1,10 +1,12 @@
|
|||
#pragma once
|
||||
|
||||
#include <nano/lib/numbers.hpp>
|
||||
#include <nano/lib/numbers_templ.hpp>
|
||||
#include <nano/lib/observer_set.hpp>
|
||||
#include <nano/lib/thread_pool.hpp>
|
||||
#include <nano/node/fwd.hpp>
|
||||
#include <nano/secure/common.hpp>
|
||||
#include <nano/secure/fwd.hpp>
|
||||
|
||||
#include <boost/multi_index/hashed_index.hpp>
|
||||
#include <boost/multi_index/member.hpp>
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@
|
|||
|
||||
#include <boost/algorithm/string/erase.hpp>
|
||||
#include <boost/format.hpp>
|
||||
#include <boost/range/iterator_range.hpp>
|
||||
|
||||
std::shared_ptr<request_type> nano::distributed_work::peer_request::get_prepared_json_request (std::string const & request_string_a) const
|
||||
{
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@
|
|||
#include <nano/lib/numbers.hpp>
|
||||
#include <nano/lib/timer.hpp>
|
||||
#include <nano/lib/work.hpp>
|
||||
#include <nano/node/common.hpp>
|
||||
#include <nano/node/endpoint.hpp>
|
||||
|
||||
#include <optional>
|
||||
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
#pragma once
|
||||
|
||||
#include <nano/lib/numbers.hpp>
|
||||
#include <nano/lib/numbers_templ.hpp>
|
||||
|
||||
#include <atomic>
|
||||
#include <functional>
|
||||
|
|
|
|||
|
|
@ -9,6 +9,7 @@
|
|||
#include <nano/node/vote_generator.hpp>
|
||||
#include <nano/node/vote_router.hpp>
|
||||
#include <nano/secure/ledger.hpp>
|
||||
#include <nano/secure/vote.hpp>
|
||||
|
||||
using namespace std::chrono;
|
||||
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@
|
|||
|
||||
#include <nano/lib/id_dispenser.hpp>
|
||||
#include <nano/lib/logging.hpp>
|
||||
#include <nano/lib/numbers_templ.hpp>
|
||||
#include <nano/lib/stats_enums.hpp>
|
||||
#include <nano/node/election_status.hpp>
|
||||
#include <nano/node/vote_with_weight_info.hpp>
|
||||
|
|
|
|||
|
|
@ -2,10 +2,11 @@
|
|||
#include <nano/lib/memory.hpp>
|
||||
#include <nano/lib/stream.hpp>
|
||||
#include <nano/node/active_elections.hpp>
|
||||
#include <nano/node/common.hpp>
|
||||
#include <nano/node/election.hpp>
|
||||
#include <nano/node/endpoint.hpp>
|
||||
#include <nano/node/network.hpp>
|
||||
#include <nano/node/wallet.hpp>
|
||||
#include <nano/secure/vote.hpp>
|
||||
|
||||
#include <boost/format.hpp>
|
||||
|
||||
|
|
@ -27,6 +28,12 @@ uint64_t nano::ip_address_hash_raw (boost::asio::ip::address const & ip_a, uint1
|
|||
return result;
|
||||
}
|
||||
|
||||
uint64_t nano::endpoint_hash_raw (nano::endpoint const & endpoint_a)
|
||||
{
|
||||
uint64_t result (nano::ip_address_hash_raw (endpoint_a.address (), endpoint_a.port ()));
|
||||
return result;
|
||||
}
|
||||
|
||||
bool nano::parse_port (std::string const & string_a, uint16_t & port_a)
|
||||
{
|
||||
bool result = false;
|
||||
|
|
@ -1,13 +1,15 @@
|
|||
#pragma once
|
||||
|
||||
#include <nano/boost/asio/ip/tcp.hpp>
|
||||
#include <nano/lib/jsonconfig.hpp>
|
||||
#include <nano/lib/memory.hpp>
|
||||
#include <nano/lib/network_filter.hpp>
|
||||
#include <nano/secure/common.hpp>
|
||||
|
||||
#include <bitset>
|
||||
#include <cstdint>
|
||||
#include <optional>
|
||||
#include <string>
|
||||
|
||||
namespace boost::asio::ip
|
||||
{
|
||||
class address;
|
||||
}
|
||||
|
||||
namespace nano
|
||||
{
|
||||
|
|
@ -18,16 +20,11 @@ bool parse_endpoint (std::string const &, nano::endpoint &);
|
|||
std::optional<nano::endpoint> parse_endpoint (std::string const &);
|
||||
bool parse_tcp_endpoint (std::string const &, nano::tcp_endpoint &);
|
||||
uint64_t ip_address_hash_raw (boost::asio::ip::address const & ip_a, uint16_t port = 0);
|
||||
uint64_t endpoint_hash_raw (nano::endpoint const & endpoint_a);
|
||||
}
|
||||
|
||||
namespace
|
||||
{
|
||||
uint64_t endpoint_hash_raw (nano::endpoint const & endpoint_a)
|
||||
{
|
||||
uint64_t result (nano::ip_address_hash_raw (endpoint_a.address (), endpoint_a.port ()));
|
||||
return result;
|
||||
}
|
||||
|
||||
template <std::size_t size>
|
||||
struct endpoint_hash
|
||||
{
|
||||
|
|
@ -38,7 +35,7 @@ struct endpoint_hash<8>
|
|||
{
|
||||
std::size_t operator() (nano::endpoint const & endpoint_a) const
|
||||
{
|
||||
return endpoint_hash_raw (endpoint_a);
|
||||
return nano::endpoint_hash_raw (endpoint_a);
|
||||
}
|
||||
};
|
||||
|
||||
|
|
@ -47,7 +44,7 @@ struct endpoint_hash<4>
|
|||
{
|
||||
std::size_t operator() (nano::endpoint const & endpoint_a) const
|
||||
{
|
||||
uint64_t big (endpoint_hash_raw (endpoint_a));
|
||||
uint64_t big = nano::endpoint_hash_raw (endpoint_a);
|
||||
uint32_t result (static_cast<uint32_t> (big) ^ static_cast<uint32_t> (big >> 32));
|
||||
return result;
|
||||
}
|
||||
|
|
@ -82,60 +79,19 @@ struct ip_address_hash<4>
|
|||
namespace std
|
||||
{
|
||||
template <>
|
||||
struct hash<::nano::endpoint>
|
||||
{
|
||||
std::size_t operator() (::nano::endpoint const & endpoint_a) const
|
||||
{
|
||||
endpoint_hash<sizeof (std::size_t)> ehash;
|
||||
return ehash (endpoint_a);
|
||||
}
|
||||
};
|
||||
struct hash<::nano::endpoint>;
|
||||
|
||||
#ifndef BOOST_ASIO_HAS_STD_HASH
|
||||
template <>
|
||||
struct hash<boost::asio::ip::address>
|
||||
{
|
||||
std::size_t operator() (boost::asio::ip::address const & ip_a) const
|
||||
{
|
||||
ip_address_hash<sizeof (std::size_t)> ihash;
|
||||
return ihash (ip_a);
|
||||
}
|
||||
};
|
||||
struct hash<boost::asio::ip::address>;
|
||||
#endif
|
||||
}
|
||||
|
||||
namespace boost
|
||||
{
|
||||
template <>
|
||||
struct hash<::nano::endpoint>
|
||||
{
|
||||
std::size_t operator() (::nano::endpoint const & endpoint_a) const
|
||||
{
|
||||
std::hash<::nano::endpoint> hash;
|
||||
return hash (endpoint_a);
|
||||
}
|
||||
};
|
||||
struct hash<::nano::endpoint>;
|
||||
|
||||
template <>
|
||||
struct hash<boost::asio::ip::address>
|
||||
{
|
||||
std::size_t operator() (boost::asio::ip::address const & ip_a) const
|
||||
{
|
||||
std::hash<boost::asio::ip::address> hash;
|
||||
return hash (ip_a);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
namespace nano
|
||||
{
|
||||
/** Helper guard which contains all the necessary purge (remove all memory even if used) functions */
|
||||
class node_singleton_memory_pool_purge_guard
|
||||
{
|
||||
public:
|
||||
node_singleton_memory_pool_purge_guard ();
|
||||
|
||||
private:
|
||||
nano::cleanup_guard cleanup_guard;
|
||||
};
|
||||
struct hash<boost::asio::ip::address>;
|
||||
}
|
||||
52
nano/node/endpoint_templ.hpp
Normal file
52
nano/node/endpoint_templ.hpp
Normal file
|
|
@ -0,0 +1,52 @@
|
|||
#pragma once
|
||||
|
||||
#include <nano/boost/asio/ip/tcp.hpp>
|
||||
#include <nano/node/endpoint.hpp>
|
||||
|
||||
namespace std
|
||||
{
|
||||
template <>
|
||||
struct hash<::nano::endpoint>
|
||||
{
|
||||
std::size_t operator() (::nano::endpoint const & endpoint_a) const
|
||||
{
|
||||
endpoint_hash<sizeof (std::size_t)> ehash;
|
||||
return ehash (endpoint_a);
|
||||
}
|
||||
};
|
||||
|
||||
#ifndef BOOST_ASIO_HAS_STD_HASH
|
||||
template <>
|
||||
struct hash<boost::asio::ip::address>
|
||||
{
|
||||
std::size_t operator() (boost::asio::ip::address const & ip_a) const
|
||||
{
|
||||
ip_address_hash<sizeof (std::size_t)> ihash;
|
||||
return ihash (ip_a);
|
||||
}
|
||||
};
|
||||
#endif
|
||||
}
|
||||
|
||||
namespace boost
|
||||
{
|
||||
template <>
|
||||
struct hash<::nano::endpoint>
|
||||
{
|
||||
std::size_t operator() (::nano::endpoint const & endpoint_a) const
|
||||
{
|
||||
std::hash<::nano::endpoint> hash;
|
||||
return hash (endpoint_a);
|
||||
}
|
||||
};
|
||||
|
||||
template <>
|
||||
struct hash<boost::asio::ip::address>
|
||||
{
|
||||
std::size_t operator() (boost::asio::ip::address const & ip_a) const
|
||||
{
|
||||
std::hash<boost::asio::ip::address> hash;
|
||||
return hash (ip_a);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
|
@ -1,5 +1,6 @@
|
|||
#include <nano/lib/blocks.hpp>
|
||||
#include <nano/lib/threading.hpp>
|
||||
#include <nano/lib/work_version.hpp>
|
||||
#include <nano/node/epoch_upgrader.hpp>
|
||||
#include <nano/node/node.hpp>
|
||||
#include <nano/secure/ledger.hpp>
|
||||
|
|
|
|||
|
|
@ -1,22 +1,18 @@
|
|||
#pragma once
|
||||
|
||||
#include <nano/lib/epoch.hpp>
|
||||
#include <nano/lib/fwd.hpp>
|
||||
#include <nano/lib/locks.hpp>
|
||||
#include <nano/lib/logging.hpp>
|
||||
#include <nano/lib/numbers.hpp>
|
||||
#include <nano/node/fwd.hpp>
|
||||
#include <nano/secure/fwd.hpp>
|
||||
#include <nano/store/fwd.hpp>
|
||||
|
||||
#include <cstdint>
|
||||
#include <future>
|
||||
|
||||
namespace nano
|
||||
{
|
||||
class node;
|
||||
class ledger;
|
||||
namespace store
|
||||
{
|
||||
class component;
|
||||
}
|
||||
class network_params;
|
||||
|
||||
class epoch_upgrader final
|
||||
{
|
||||
public:
|
||||
|
|
|
|||
|
|
@ -1,19 +1,13 @@
|
|||
#pragma once
|
||||
|
||||
#include <nano/lib/fwd.hpp>
|
||||
#include <nano/node/transport/fwd.hpp>
|
||||
#include <nano/secure/fwd.hpp>
|
||||
#include <nano/store/fwd.hpp>
|
||||
|
||||
// TODO: Move to lib/fwd.hpp
|
||||
namespace nano
|
||||
{
|
||||
class block;
|
||||
class container_info;
|
||||
class thread_pool;
|
||||
}
|
||||
|
||||
namespace nano
|
||||
{
|
||||
class account_sets_config;
|
||||
class active_elections;
|
||||
class block_processor;
|
||||
class bootstrap_config;
|
||||
|
|
@ -21,7 +15,6 @@ class bootstrap_server;
|
|||
class bootstrap_service;
|
||||
class confirming_set;
|
||||
class election;
|
||||
class ledger;
|
||||
class local_block_broadcaster;
|
||||
class local_vote_history;
|
||||
class logger;
|
||||
|
|
@ -38,6 +31,8 @@ class rep_crawler;
|
|||
class rep_tiers;
|
||||
class stats;
|
||||
class vote_cache;
|
||||
enum class vote_code;
|
||||
enum class vote_source;
|
||||
class vote_generator;
|
||||
class vote_processor;
|
||||
class vote_router;
|
||||
|
|
@ -56,4 +51,4 @@ class hinted;
|
|||
class manual;
|
||||
class optimistic;
|
||||
class priority;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,3 +1,4 @@
|
|||
#include <nano/lib/block_type.hpp>
|
||||
#include <nano/lib/blocks.hpp>
|
||||
#include <nano/lib/numbers.hpp>
|
||||
#include <nano/node/ipc/flatbuffers_util.hpp>
|
||||
|
|
|
|||
|
|
@ -2,6 +2,12 @@
|
|||
#include <nano/lib/tomlconfig.hpp>
|
||||
#include <nano/node/ipc/ipc_config.hpp>
|
||||
|
||||
nano::ipc::ipc_config_tcp_socket::ipc_config_tcp_socket (nano::network_constants & network_constants) :
|
||||
network_constants{ network_constants },
|
||||
port{ network_constants.default_ipc_port }
|
||||
{
|
||||
}
|
||||
|
||||
nano::error nano::ipc::ipc_config::serialize_toml (nano::tomlconfig & toml) const
|
||||
{
|
||||
nano::tomlconfig tcp_l;
|
||||
|
|
|
|||
|
|
@ -2,12 +2,12 @@
|
|||
|
||||
#include <nano/lib/config.hpp>
|
||||
#include <nano/lib/errors.hpp>
|
||||
#include <nano/lib/fwd.hpp>
|
||||
|
||||
#include <string>
|
||||
|
||||
namespace nano
|
||||
{
|
||||
class tomlconfig;
|
||||
namespace ipc
|
||||
{
|
||||
/** Base class for transport configurations */
|
||||
|
|
@ -46,11 +46,7 @@ namespace ipc
|
|||
class ipc_config_tcp_socket : public ipc_config_transport
|
||||
{
|
||||
public:
|
||||
ipc_config_tcp_socket (nano::network_constants & network_constants) :
|
||||
network_constants{ network_constants },
|
||||
port{ network_constants.default_ipc_port }
|
||||
{
|
||||
}
|
||||
ipc_config_tcp_socket (nano::network_constants & network_constants);
|
||||
nano::network_constants & network_constants;
|
||||
/** Listening port */
|
||||
uint16_t port;
|
||||
|
|
|
|||
|
|
@ -1,13 +1,16 @@
|
|||
#include <nano/lib/block_type.hpp>
|
||||
#include <nano/lib/blocks.hpp>
|
||||
#include <nano/lib/config.hpp>
|
||||
#include <nano/lib/json_error_response.hpp>
|
||||
#include <nano/lib/jsonconfig.hpp>
|
||||
#include <nano/lib/stats_sinks.hpp>
|
||||
#include <nano/lib/timer.hpp>
|
||||
#include <nano/lib/work_version.hpp>
|
||||
#include <nano/node/active_elections.hpp>
|
||||
#include <nano/node/bootstrap/bootstrap_service.hpp>
|
||||
#include <nano/node/common.hpp>
|
||||
#include <nano/node/confirming_set.hpp>
|
||||
#include <nano/node/election.hpp>
|
||||
#include <nano/node/endpoint.hpp>
|
||||
#include <nano/node/json_handler.hpp>
|
||||
#include <nano/node/node.hpp>
|
||||
#include <nano/node/node_rpc_config.hpp>
|
||||
|
|
|
|||
|
|
@ -8,6 +8,8 @@
|
|||
#include <nano/node/node.hpp>
|
||||
#include <nano/secure/ledger.hpp>
|
||||
|
||||
#include <boost/range/iterator_range.hpp>
|
||||
|
||||
nano::local_block_broadcaster::local_block_broadcaster (local_block_broadcaster_config const & config_a, nano::node & node_a, nano::block_processor & block_processor_a, nano::network & network_a, nano::confirming_set & confirming_set_a, nano::stats & stats_a, nano::logger & logger_a, bool enabled_a) :
|
||||
config{ config_a },
|
||||
node{ node_a },
|
||||
|
|
@ -230,4 +232,4 @@ nano::container_info nano::local_block_broadcaster::container_info () const
|
|||
nano::container_info info;
|
||||
info.put ("local", local_blocks);
|
||||
return info;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
#pragma once
|
||||
|
||||
#include <nano/lib/blocks.hpp>
|
||||
#include <nano/lib/interval.hpp>
|
||||
#include <nano/lib/locks.hpp>
|
||||
#include <nano/lib/processing_queue.hpp>
|
||||
#include <nano/lib/rate_limiting.hpp>
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@
|
|||
|
||||
#include <nano/lib/locks.hpp>
|
||||
#include <nano/lib/numbers.hpp>
|
||||
#include <nano/lib/numbers_templ.hpp>
|
||||
#include <nano/node/fwd.hpp>
|
||||
|
||||
#include <boost/multi_index/hashed_index.hpp>
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@
|
|||
#include <nano/node/message_processor.hpp>
|
||||
#include <nano/node/node.hpp>
|
||||
#include <nano/node/telemetry.hpp>
|
||||
#include <nano/secure/vote.hpp>
|
||||
|
||||
nano::message_processor::message_processor (message_processor_config const & config_a, nano::node & node_a) :
|
||||
config{ config_a },
|
||||
|
|
@ -317,4 +318,4 @@ nano::error nano::message_processor_config::deserialize (nano::tomlconfig & toml
|
|||
toml.get ("max_queue", max_queue);
|
||||
|
||||
return toml.get_error ();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,15 +1,18 @@
|
|||
#include <nano/lib/block_type.hpp>
|
||||
#include <nano/lib/blocks.hpp>
|
||||
#include <nano/lib/config.hpp>
|
||||
#include <nano/lib/enum_util.hpp>
|
||||
#include <nano/lib/jsonconfig.hpp>
|
||||
#include <nano/lib/memory.hpp>
|
||||
#include <nano/lib/stats_enums.hpp>
|
||||
#include <nano/lib/stream.hpp>
|
||||
#include <nano/lib/utility.hpp>
|
||||
#include <nano/lib/work.hpp>
|
||||
#include <nano/node/common.hpp>
|
||||
#include <nano/node/election.hpp>
|
||||
#include <nano/node/endpoint.hpp>
|
||||
#include <nano/node/messages.hpp>
|
||||
#include <nano/node/network.hpp>
|
||||
#include <nano/secure/vote.hpp>
|
||||
|
||||
#include <boost/asio/ip/address_v6.hpp>
|
||||
#include <boost/endian/conversion.hpp>
|
||||
|
|
@ -1873,7 +1876,7 @@ void nano::asc_pull_ack::blocks_payload::serialize (nano::stream & stream) const
|
|||
nano::serialize_block (stream, *block);
|
||||
}
|
||||
// For convenience, end with null block terminator
|
||||
nano::serialize_block_type (stream, nano::block_type::not_a_block);
|
||||
nano::write (stream, nano::block_type::not_a_block);
|
||||
}
|
||||
|
||||
void nano::asc_pull_ack::blocks_payload::deserialize (nano::stream & stream)
|
||||
|
|
|
|||
|
|
@ -1,19 +1,19 @@
|
|||
#pragma once
|
||||
|
||||
#include <nano/boost/asio/ip/tcp.hpp>
|
||||
#include <nano/lib/asio.hpp>
|
||||
#include <nano/lib/block_uniquer.hpp>
|
||||
#include <nano/lib/config.hpp>
|
||||
#include <nano/lib/errors.hpp>
|
||||
#include <nano/lib/jsonconfig.hpp>
|
||||
#include <nano/lib/fwd.hpp>
|
||||
#include <nano/lib/logging.hpp>
|
||||
#include <nano/lib/memory.hpp>
|
||||
#include <nano/lib/network_filter.hpp>
|
||||
#include <nano/lib/numbers.hpp>
|
||||
#include <nano/lib/object_stream.hpp>
|
||||
#include <nano/lib/stats_enums.hpp>
|
||||
#include <nano/lib/stream.hpp>
|
||||
#include <nano/node/common.hpp>
|
||||
#include <nano/node/endpoint.hpp>
|
||||
#include <nano/secure/common.hpp>
|
||||
#include <nano/secure/fwd.hpp>
|
||||
|
||||
#include <bitset>
|
||||
#include <cstdint>
|
||||
|
|
@ -22,6 +22,12 @@
|
|||
#include <variant>
|
||||
#include <vector>
|
||||
|
||||
namespace nano
|
||||
{
|
||||
using block_uniquer = uniquer<nano::uint256_union, nano::block>;
|
||||
using vote_uniquer = uniquer<nano::block_hash, nano::vote>;
|
||||
}
|
||||
|
||||
namespace nano
|
||||
{
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
#include <nano/lib/logging.hpp>
|
||||
#include <nano/lib/network_filter.hpp>
|
||||
#include <nano/node/common.hpp>
|
||||
#include <nano/node/endpoint.hpp>
|
||||
#include <nano/node/messages.hpp>
|
||||
#include <nano/node/peer_exclusion.hpp>
|
||||
#include <nano/node/transport/common.hpp>
|
||||
|
|
|
|||
|
|
@ -1,9 +1,11 @@
|
|||
#include <nano/lib/block_type.hpp>
|
||||
#include <nano/lib/blocks.hpp>
|
||||
#include <nano/lib/stream.hpp>
|
||||
#include <nano/lib/thread_pool.hpp>
|
||||
#include <nano/lib/thread_runner.hpp>
|
||||
#include <nano/lib/tomlconfig.hpp>
|
||||
#include <nano/lib/utility.hpp>
|
||||
#include <nano/lib/work_version.hpp>
|
||||
#include <nano/node/active_elections.hpp>
|
||||
#include <nano/node/backlog_population.hpp>
|
||||
#include <nano/node/bandwidth_limiter.hpp>
|
||||
|
|
@ -11,10 +13,10 @@
|
|||
#include <nano/node/bootstrap/bootstrap_service.hpp>
|
||||
#include <nano/node/bootstrap_weights_beta.hpp>
|
||||
#include <nano/node/bootstrap_weights_live.hpp>
|
||||
#include <nano/node/common.hpp>
|
||||
#include <nano/node/confirming_set.hpp>
|
||||
#include <nano/node/daemonconfig.hpp>
|
||||
#include <nano/node/election_status.hpp>
|
||||
#include <nano/node/endpoint.hpp>
|
||||
#include <nano/node/local_block_broadcaster.hpp>
|
||||
#include <nano/node/local_vote_history.hpp>
|
||||
#include <nano/node/make_store.hpp>
|
||||
|
|
@ -38,6 +40,7 @@
|
|||
#include <nano/secure/ledger.hpp>
|
||||
#include <nano/secure/ledger_set_any.hpp>
|
||||
#include <nano/secure/ledger_set_confirmed.hpp>
|
||||
#include <nano/secure/vote.hpp>
|
||||
#include <nano/store/component.hpp>
|
||||
#include <nano/store/rocksdb/rocksdb.hpp>
|
||||
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
#pragma once
|
||||
|
||||
#include <nano/lib/numbers.hpp>
|
||||
#include <nano/lib/numbers_templ.hpp>
|
||||
#include <nano/lib/utility.hpp>
|
||||
#include <nano/secure/common.hpp>
|
||||
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
#pragma once
|
||||
|
||||
#include <nano/node/common.hpp>
|
||||
#include <nano/node/endpoint.hpp>
|
||||
#include <nano/node/endpoint_templ.hpp>
|
||||
|
||||
#include <boost/multi_index/hashed_index.hpp>
|
||||
#include <boost/multi_index/member.hpp>
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
#pragma once
|
||||
|
||||
#include <nano/lib/locks.hpp>
|
||||
#include <nano/node/common.hpp>
|
||||
#include <nano/node/endpoint.hpp>
|
||||
#include <nano/node/fwd.hpp>
|
||||
|
||||
#include <atomic>
|
||||
|
|
@ -54,4 +54,4 @@ private:
|
|||
nano::condition_variable condition;
|
||||
std::thread thread;
|
||||
};
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
#pragma once
|
||||
|
||||
#include <nano/boost/asio/ip/tcp.hpp>
|
||||
#include <nano/lib/locks.hpp>
|
||||
|
||||
#include <miniupnp/miniupnpc/include/miniupnpc.h>
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@
|
|||
|
||||
#include <nano/lib/locks.hpp>
|
||||
#include <nano/lib/numbers.hpp>
|
||||
#include <nano/lib/numbers_templ.hpp>
|
||||
#include <nano/secure/common.hpp>
|
||||
|
||||
#include <boost/multi_index/hashed_index.hpp>
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
#include <nano/lib/enum_util.hpp>
|
||||
#include <nano/lib/logging.hpp>
|
||||
#include <nano/lib/stats.hpp>
|
||||
#include <nano/lib/thread_roles.hpp>
|
||||
#include <nano/node/online_reps.hpp>
|
||||
#include <nano/node/rep_tiers.hpp>
|
||||
|
|
@ -149,4 +150,4 @@ nano::container_info nano::rep_tiers::container_info () const
|
|||
nano::stat::detail nano::to_stat_detail (nano::rep_tier tier)
|
||||
{
|
||||
return nano::enum_util::cast<nano::stat::detail> (tier);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
#pragma once
|
||||
|
||||
#include <nano/lib/numbers.hpp>
|
||||
#include <nano/lib/numbers_templ.hpp>
|
||||
#include <nano/lib/utility.hpp>
|
||||
#include <nano/secure/common.hpp>
|
||||
|
||||
|
|
@ -64,4 +65,4 @@ private:
|
|||
mutable nano::mutex mutex;
|
||||
std::thread thread;
|
||||
};
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@
|
|||
#include <nano/node/node.hpp>
|
||||
#include <nano/node/repcrawler.hpp>
|
||||
#include <nano/secure/ledger.hpp>
|
||||
#include <nano/secure/vote.hpp>
|
||||
|
||||
#include <ranges>
|
||||
|
||||
|
|
|
|||
|
|
@ -10,6 +10,7 @@
|
|||
#include <boost/multi_index/member.hpp>
|
||||
#include <boost/multi_index/ordered_index.hpp>
|
||||
#include <boost/multi_index/random_access_index.hpp>
|
||||
#include <boost/multi_index/sequenced_index.hpp>
|
||||
#include <boost/multi_index_container.hpp>
|
||||
#include <boost/optional.hpp>
|
||||
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
#include <nano/lib/blocks.hpp>
|
||||
#include <nano/lib/stats.hpp>
|
||||
#include <nano/node/common.hpp>
|
||||
#include <nano/node/election.hpp>
|
||||
#include <nano/node/endpoint.hpp>
|
||||
#include <nano/node/local_vote_history.hpp>
|
||||
#include <nano/node/network.hpp>
|
||||
#include <nano/node/node.hpp>
|
||||
|
|
|
|||
|
|
@ -1,5 +1,8 @@
|
|||
#pragma once
|
||||
|
||||
#include <nano/lib/errors.hpp>
|
||||
#include <nano/lib/numbers.hpp>
|
||||
#include <nano/lib/numbers_templ.hpp>
|
||||
#include <nano/node/fwd.hpp>
|
||||
#include <nano/secure/common.hpp>
|
||||
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
#pragma once
|
||||
|
||||
#include <nano/lib/utility.hpp>
|
||||
#include <nano/node/common.hpp>
|
||||
#include <nano/node/endpoint.hpp>
|
||||
#include <nano/node/fwd.hpp>
|
||||
#include <nano/node/messages.hpp>
|
||||
#include <nano/node/nodeconfig.hpp>
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
#include <nano/node/common.hpp>
|
||||
#include <nano/node/endpoint.hpp>
|
||||
#include <nano/node/node.hpp>
|
||||
#include <nano/node/transport/channel.hpp>
|
||||
#include <nano/node/transport/transport.hpp>
|
||||
|
|
|
|||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue