Skip to content

Commit

Permalink
Merge branch 'develop' into vote-processor-tiers
Browse files Browse the repository at this point in the history
# Conflicts:
#	nano/node/node.cpp
  • Loading branch information
pwojcikdev committed Mar 9, 2024
2 parents c36197d + d5bf9a2 commit e62602c
Show file tree
Hide file tree
Showing 22 changed files with 868 additions and 651 deletions.
1 change: 1 addition & 0 deletions nano/core_test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ add_executable(
optimistic_scheduler.cpp
processing_queue.cpp
processor_service.cpp
rep_crawler.cpp
peer_container.cpp
scheduler_buckets.cpp
request_aggregator.cpp
Expand Down
16 changes: 2 additions & 14 deletions nano/core_test/active_transactions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,6 @@

using namespace std::chrono_literals;

namespace nano
{
/*
* Tests that an election can be confirmed as the result of a confirmation request
*
Expand Down Expand Up @@ -81,10 +79,7 @@ TEST (active_transactions, confirm_election_by_request)
ASSERT_FALSE (peers.empty ());

// Add representative (node1) to disabled rep crawler of node2
{
nano::lock_guard<nano::mutex> guard (node2.rep_crawler.probable_reps_mutex);
node2.rep_crawler.probable_reps.emplace (nano::dev::genesis_key.pub, *peers.cbegin ());
}
node2.rep_crawler.force_add_rep (nano::dev::genesis_key.pub, *peers.cbegin ());

// Expect a vote to come back
ASSERT_TIMELY (5s, election->votes ().size () >= 1);
Expand All @@ -98,10 +93,7 @@ TEST (active_transactions, confirm_election_by_request)
ASSERT_TIMELY (5s, nano::test::confirmed (node1, { send1 }));
ASSERT_TIMELY (5s, nano::test::confirmed (node2, { send1 }));
}
}

namespace nano
{
TEST (active_transactions, confirm_frontier)
{
nano::test::system system;
Expand Down Expand Up @@ -145,10 +137,7 @@ TEST (active_transactions, confirm_frontier)
// Add representative to disabled rep crawler
auto peers (node2.network.random_set (1));
ASSERT_FALSE (peers.empty ());
{
nano::lock_guard<nano::mutex> guard (node2.rep_crawler.probable_reps_mutex);
node2.rep_crawler.probable_reps.emplace (nano::dev::genesis_key.pub, *peers.begin ());
}
node2.rep_crawler.force_add_rep (nano::dev::genesis_key.pub, *peers.begin ());

ASSERT_EQ (nano::block_status::progress, node2.process (send));
ASSERT_TIMELY (5s, !node2.active.empty ());
Expand All @@ -161,7 +150,6 @@ TEST (active_transactions, confirm_frontier)
ASSERT_TIMELY (5s, node2.active.empty ());
ASSERT_GT (election2->confirmation_request_count, 0u);
}
}

TEST (active_transactions, keep_local)
{
Expand Down
4 changes: 2 additions & 2 deletions nano/core_test/confirmation_solicitor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ TEST (confirmation_solicitor, batches)
auto & node2 = *system.add_node (node_flags);
auto channel1 = nano::test::establish_tcp (system, node2, node1.network.endpoint ());
// Solicitor will only solicit from this representative
nano::representative representative (nano::dev::genesis_key.pub, channel1);
nano::representative representative{ nano::dev::genesis_key.pub, channel1 };
std::vector<nano::representative> representatives{ representative };
nano::confirmation_solicitor solicitor (node2.network, node2.config);
solicitor.prepare (representatives);
Expand Down Expand Up @@ -71,7 +71,7 @@ TEST (confirmation_solicitor, different_hash)
auto & node2 = *system.add_node (node_flags);
auto channel1 = nano::test::establish_tcp (system, node2, node1.network.endpoint ());
// Solicitor will only solicit from this representative
nano::representative representative (nano::dev::genesis_key.pub, channel1);
nano::representative representative{ nano::dev::genesis_key.pub, channel1 };
std::vector<nano::representative> representatives{ representative };
nano::confirmation_solicitor solicitor (node2.network, node2.config);
solicitor.prepare (representatives);
Expand Down
2 changes: 1 addition & 1 deletion nano/core_test/election.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -255,7 +255,7 @@ TEST (election, quorum_minimum_update_weight_before_quorum_checks)
ASSERT_NE (channel, nullptr);

auto vote2 = nano::test::make_final_vote (key1, { send1->hash () });
ASSERT_FALSE (node1.rep_crawler.response (channel, vote2, true));
node1.rep_crawler.force_process (vote2, channel);

ASSERT_FALSE (election->confirmed ());
{
Expand Down
Loading

0 comments on commit e62602c

Please sign in to comment.