Fix unit test node vote republish (#3344)

* Fix for unit test node.vote_republish

The test was not allowing enough time for the block to become active.

* Code improvements to test node.vote_republish
This commit is contained in:
dsiganos 2021-06-16 23:32:32 +01:00 committed by GitHub
commit b5c1925e29
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -2917,6 +2917,7 @@ TEST (node, vote_republish)
auto & node1 (*system.nodes[0]);
auto & node2 (*system.nodes[1]);
nano::keypair key2;
// by not setting a private key on node1's wallet, it is stopped from voting
system.wallet (1)->insert_adhoc (key2.prv);
nano::genesis genesis;
nano::send_block_builder builder;
@ -2936,10 +2937,10 @@ TEST (node, vote_republish)
.build_shared ();
node1.process_active (send1);
ASSERT_TIMELY (5s, node2.block (send1->hash ()));
node1.active.publish (send2);
node1.process_active (send2);
auto vote (std::make_shared<nano::vote> (nano::dev_genesis_key.pub, nano::dev_genesis_key.prv, std::numeric_limits<uint64_t>::max (), send2));
ASSERT_TRUE (node1.active.active (*send1));
ASSERT_TRUE (node2.active.active (*send1));
ASSERT_TIMELY (10s, node2.active.active (*send1));
node1.vote_processor.vote (vote, std::make_shared<nano::transport::channel_loopback> (node1));
ASSERT_TIMELY (10s, node1.block (send2->hash ()));
ASSERT_TIMELY (10s, node2.block (send2->hash ()));