Skip to content

Commit

Permalink
Fix intermittently failing conflicts.adjusted_multiplier_test (#2745)
Browse files Browse the repository at this point in the history
  • Loading branch information
wezrule authored Apr 28, 2020
1 parent e31cdeb commit d8ec43b
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions nano/core_test/conflicts.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -247,9 +247,12 @@ TEST (conflicts, adjusted_multiplier)
node1.process_active (open2);
auto change1 (std::make_shared<nano::state_block> (key3.pub, open2->hash (), nano::test_genesis_key.pub, nano::xrb_ratio, 0, key3.prv, key3.pub, *system.work.generate (open2->hash ())));
node1.process_active (change1);
nano::keypair key4;
auto send5 (std::make_shared<nano::state_block> (key3.pub, change1->hash (), nano::test_genesis_key.pub, 0, key4.pub, key3.prv, key3.pub, *system.work.generate (change1->hash ()))); // Pending for open epoch block
node1.process_active (send5);
node1.block_processor.flush ();
system.deadline_set (3s);
while (node1.active.size () != 10)
while (node1.active.size () != 11)
{
ASSERT_NO_ERROR (system.poll ());
}
Expand All @@ -276,10 +279,8 @@ TEST (conflicts, adjusted_multiplier)
// key3
ASSERT_GT (adjusted_multipliers.find (send4->hash ())->second, adjusted_multipliers.find (open2->hash ())->second);
ASSERT_GT (adjusted_multipliers.find (open2->hash ())->second, adjusted_multipliers.find (change1->hash ())->second);
ASSERT_GT (adjusted_multipliers.find (change1->hash ())->second, adjusted_multipliers.find (send5->hash ())->second);
// Independent elections can have higher difficulty than adjusted tree
nano::keypair key4;
auto send5 (std::make_shared<nano::state_block> (key3.pub, change1->hash (), nano::test_genesis_key.pub, 0, key4.pub, key3.prv, key3.pub, *system.work.generate (change1->hash ()))); // Pending for open epoch block
node1.process_active (send5);
auto open_epoch2 (std::make_shared<nano::state_block> (key4.pub, 0, 0, 0, node1.ledger.epoch_link (nano::epoch::epoch_1), nano::test_genesis_key.prv, nano::test_genesis_key.pub, *system.work.generate (key4.pub, nano::difficulty::from_multiplier ((adjusted_multipliers.find (send1->hash ())->second), node1.network_params.network.publish_thresholds.base))));
ASSERT_GT (open_epoch2->difficulty (), nano::difficulty::from_multiplier ((adjusted_multipliers.find (send1->hash ())->second), node1.network_params.network.publish_thresholds.base));
node1.process_active (open_epoch2);
Expand Down

0 comments on commit d8ec43b

Please sign in to comment.