From e010105483aa8d82c3137b0ab3de43a6c487f867 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Piotr=20Wo=CC=81jcik?= <3044353+pwojcikdev@users.noreply.github.com> Date: Sat, 16 Mar 2024 14:01:01 +0100 Subject: [PATCH] DEBUG DEVELOP --- nano/node/transport/tcp.cpp | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/nano/node/transport/tcp.cpp b/nano/node/transport/tcp.cpp index 6dab450206..5f280abf68 100644 --- a/nano/node/transport/tcp.cpp +++ b/nano/node/transport/tcp.cpp @@ -197,8 +197,10 @@ std::unordered_set> nano::transport::t for (auto i (0); i < random_cutoff && result.size () < count_a; ++i) { auto index (nano::random_pool::generate_word32 (0, static_cast (peers_size - 1))); + release_assert (index < channels.size ()); auto channel = channels.get ()[index].channel; + release_assert (channel != nullptr); if (!channel->alive ()) { continue; @@ -588,11 +590,15 @@ void nano::transport::tcp_channels::ongoing_merge (size_t channel_index, nano::k void nano::transport::tcp_channels::list (std::deque> & deque_a, uint8_t minimum_version_a, bool include_temporary_channels_a) { nano::lock_guard lock{ mutex }; - // clang-format off - nano::transform_if (channels.get ().begin (), channels.get ().end (), std::back_inserter (deque_a), - [include_temporary_channels_a, minimum_version_a](auto & channel_a) { return channel_a.channel->get_network_version () >= minimum_version_a && (include_temporary_channels_a || !channel_a.channel->temporary); }, - [](auto const & channel) { return channel.channel; }); - // clang-format on + + nano::transform_if ( + channels.get ().begin (), channels.get ().end (), std::back_inserter (deque_a), + [include_temporary_channels_a, minimum_version_a] (auto & channel_a) { + release_assert (channel_a.channel != nullptr); + return channel_a.channel->get_network_version () >= minimum_version_a && (include_temporary_channels_a || !channel_a.channel->temporary); }, + [] (auto const & channel) { + return channel.channel; + }); } void nano::transport::tcp_channels::modify (std::shared_ptr const & channel_a, std::function const &)> modify_callback_a)