mirror of
				https://github.com/comit-network/xmr-btc-swap.git
				synced 2025-10-31 15:09:08 -04:00 
			
		
		
		
	Change anyhow! to bail! in error scenarios
This commit is contained in:
		
							parent
							
								
									7251588e79
								
							
						
					
					
						commit
						8c40ee1da4
					
				
					 1 changed files with 5 additions and 5 deletions
				
			
		|  | @ -16,7 +16,7 @@ use crate::{ | |||
|     }, | ||||
|     seed::Seed, | ||||
| }; | ||||
| use anyhow::{anyhow, Context, Result}; | ||||
| use anyhow::{bail, Context, Result}; | ||||
| use futures::future::RemoteHandle; | ||||
| use libp2p::{ | ||||
|     core::Multiaddr, futures::FutureExt, request_response::ResponseChannel, PeerId, Swarm, | ||||
|  | @ -221,19 +221,19 @@ where | |||
|         let xmr_amount = rate.sell_quote(btc_amount)?; | ||||
| 
 | ||||
|         if xmr_amount > self.max_sell { | ||||
|             anyhow!(MaximumSellAmountExceeded { | ||||
|             bail!(MaximumSellAmountExceeded { | ||||
|                 actual: xmr_amount, | ||||
|                 max_sell: self.max_sell | ||||
|             }); | ||||
|             }) | ||||
|         } | ||||
| 
 | ||||
|         let xmr_balance = monero_wallet.get_balance().await?; | ||||
|         let xmr_lock_fees = monero_wallet.static_tx_fee_estimate(); | ||||
| 
 | ||||
|         if xmr_balance < xmr_amount + xmr_lock_fees { | ||||
|             anyhow!(BalanceTooLow { | ||||
|             bail!(BalanceTooLow { | ||||
|                 balance: xmr_balance | ||||
|             }); | ||||
|             }) | ||||
|         } | ||||
| 
 | ||||
|         let quote_response = QuoteResponse { xmr_amount }; | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Daniel Karzel
						Daniel Karzel