Remove confirmation requests for a new representative (#2721)

Because it's done in request loop quite frequent
This commit is contained in:
Sergey Kroshnin 2020-04-22 21:12:59 +03:00 committed by GitHub
commit 9463d1b359
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 26 additions and 10 deletions

View file

@ -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 ());
}
}

View file

@ -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