Fix use after scope error active_transactions.vacancy test (#4002)
This commit is contained in:
		
					parent
					
						
							
								da37e91b39
							
						
					
				
			
			
				commit
				
					
						f05cb7dfb5
					
				
			
		
					 1 changed files with 31 additions and 29 deletions
				
			
		| 
						 | 
					@ -1287,6 +1287,8 @@ TEST (active_transactions, list_active)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
TEST (active_transactions, vacancy)
 | 
					TEST (active_transactions, vacancy)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
 | 
						std::atomic<bool> updated = false;
 | 
				
			||||||
 | 
						{
 | 
				
			||||||
		nano::test::system system;
 | 
							nano::test::system system;
 | 
				
			||||||
		nano::node_config config{ nano::test::get_available_port (), system.logging };
 | 
							nano::node_config config{ nano::test::get_available_port (), system.logging };
 | 
				
			||||||
		config.active_elections_size = 1;
 | 
							config.active_elections_size = 1;
 | 
				
			||||||
| 
						 | 
					@ -1301,7 +1303,6 @@ TEST (active_transactions, vacancy)
 | 
				
			||||||
					.sign (nano::dev::genesis_key.prv, nano::dev::genesis_key.pub)
 | 
										.sign (nano::dev::genesis_key.prv, nano::dev::genesis_key.pub)
 | 
				
			||||||
					.work (*system.work.generate (nano::dev::genesis->hash ()))
 | 
										.work (*system.work.generate (nano::dev::genesis->hash ()))
 | 
				
			||||||
					.build_shared ();
 | 
										.build_shared ();
 | 
				
			||||||
	std::atomic<bool> updated = false;
 | 
					 | 
				
			||||||
		node.active.vacancy_update = [&updated] () { updated = true; };
 | 
							node.active.vacancy_update = [&updated] () { updated = true; };
 | 
				
			||||||
		ASSERT_EQ (nano::process_result::progress, node.process (*send).code);
 | 
							ASSERT_EQ (nano::process_result::progress, node.process (*send).code);
 | 
				
			||||||
		ASSERT_EQ (1, node.active.vacancy ());
 | 
							ASSERT_EQ (1, node.active.vacancy ());
 | 
				
			||||||
| 
						 | 
					@ -1317,6 +1318,7 @@ TEST (active_transactions, vacancy)
 | 
				
			||||||
		ASSERT_TIMELY (1s, updated);
 | 
							ASSERT_TIMELY (1s, updated);
 | 
				
			||||||
		ASSERT_EQ (1, node.active.vacancy ());
 | 
							ASSERT_EQ (1, node.active.vacancy ());
 | 
				
			||||||
		ASSERT_EQ (0, node.active.size ());
 | 
							ASSERT_EQ (0, node.active.size ());
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// Ensure transactions in excess of capacity are removed in fifo order
 | 
					// Ensure transactions in excess of capacity are removed in fifo order
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue