Return early if required UTXOs already big enough
If the required UTXO set is already bigger (including fees) than the amount required for the transaction we can return early, no need to go through the BNB algorithm or random selection.
This commit is contained in:
		
							parent
							
								
									474620e6a5
								
							
						
					
					
						commit
						d2d37fc06d
					
				| @ -345,6 +345,14 @@ impl<D: Database> CoinSelectionAlgorithm<D> for BranchAndBoundCoinSelection { | |||||||
|             .try_into() |             .try_into() | ||||||
|             .expect("Bitcoin amount to fit into i64"); |             .expect("Bitcoin amount to fit into i64"); | ||||||
| 
 | 
 | ||||||
|  |         if curr_value > actual_target { | ||||||
|  |             return Ok(BranchAndBoundCoinSelection::calculate_cs_result( | ||||||
|  |                 vec![], | ||||||
|  |                 required_utxos, | ||||||
|  |                 fee_amount, | ||||||
|  |             )); | ||||||
|  |         } | ||||||
|  | 
 | ||||||
|         Ok(self |         Ok(self | ||||||
|             .bnb( |             .bnb( | ||||||
|                 required_utxos.clone(), |                 required_utxos.clone(), | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user