mirror of
				https://git.wownero.com/wownero/wownero.git
				synced 2024-08-15 01:03:23 +00:00 
			
		
		
		
	get_block_template_backlog: better sorting logic
std::sort is unstable, so it can return random sets of transactions when mempool has many transactions with the same fee/byte. It can result in p2pool mining empty blocks sometimes because it doesn't pick up "new" transactions immediately.
This commit is contained in:
		
							parent
							
								
									b23116424d
								
							
						
					
					
						commit
						36ee12bd8d
					
				
					 1 changed files with 1 additions and 1 deletions
				
			
		| 
						 | 
				
			
			@ -1074,7 +1074,7 @@ namespace cryptonote
 | 
			
		|||
 | 
			
		||||
    // If the total weight is too high, choose the best paying transactions
 | 
			
		||||
    if (total_weight > max_backlog_weight)
 | 
			
		||||
      std::sort(tmp.begin(), tmp.end(), [](const auto& a, const auto& b){ return a.fee * b.weight > b.fee * a.weight; });
 | 
			
		||||
      std::stable_sort(tmp.begin(), tmp.end(), [](const auto& a, const auto& b){ return a.fee * b.weight > b.fee * a.weight; });
 | 
			
		||||
 | 
			
		||||
    backlog.clear();
 | 
			
		||||
    uint64_t w = 0;
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue