Skip to content

Commit

Permalink
Remove confirmation requests for a new representative (#2721)
Browse files Browse the repository at this point in the history
Because it's done in request loop quite frequent
  • Loading branch information
SergiySW committed Apr 22, 2020
1 parent e64f0b0 commit 9463d1b
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 10 deletions.
26 changes: 26 additions & 0 deletions nano/core_test/active_transactions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -999,3 +999,29 @@ TEST (active_transactions, election_difficulty_update_fork)
auto multiplier_receive_updated = node.active.roots.begin ()->multiplier;
ASSERT_GT (multiplier_receive_updated, multiplier_receive);
}

TEST (active_transactions, confirm_new)
{
nano::system system (1);
auto & node1 = *system.nodes[0];
nano::genesis genesis;
auto send (std::make_shared<nano::send_block> (genesis.hash (), nano::public_key (), nano::genesis_amount - 100, nano::test_genesis_key.prv, nano::test_genesis_key.pub, *system.work.generate (genesis.hash ())));
node1.process_active (send);
node1.block_processor.flush ();
ASSERT_EQ (1, node1.active.size ());
auto & node2 = *system.add_node ();
// Add key to node2
system.wallet (1)->insert_adhoc (nano::test_genesis_key.prv);
system.deadline_set (5s);
// Let node2 know about the block
while (node2.block (send->hash ()) == nullptr)
{
ASSERT_NO_ERROR (system.poll ());
}
system.deadline_set (5s);
// Wait confirmation
while (node1.ledger.cache.cemented_count < 2 || node2.ledger.cache.cemented_count < 2)
{
ASSERT_NO_ERROR (system.poll ());
}
}
10 changes: 0 additions & 10 deletions nano/node/repcrawler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -69,16 +69,6 @@ void nano::rep_crawler::validate ()
if (updated_or_inserted)
{
node.logger.try_log (boost::str (boost::format ("Found a representative at %1%") % channel->to_string ()));
// Rebroadcasting all active votes to new representative
auto blocks (node.active.list_blocks ());
for (auto i (blocks.begin ()), n (blocks.end ()); i != n; ++i)
{
if (*i != nullptr)
{
nano::confirm_req req (*i);
channel->send (req);
}
}
}
}
// This tries to assist rep nodes that have lost track of their highest sequence number by replaying our highest known vote back to them
Expand Down

0 comments on commit 9463d1b

Please sign in to comment.