mirror of
https://github.com/comit-network/xmr-btc-swap.git
synced 2025-08-06 21:44:49 -04:00
fix: clippy error
This commit is contained in:
parent
967a3184c1
commit
abf37e0128
2 changed files with 5 additions and 7 deletions
|
@ -660,9 +660,8 @@ impl Request {
|
||||||
anyhow::anyhow!("Failed to convert BTC amount to Decimal")
|
anyhow::anyhow!("Failed to convert BTC amount to Decimal")
|
||||||
})?
|
})?
|
||||||
.checked_div(xmr_amount.as_xmr())
|
.checked_div(xmr_amount.as_xmr())
|
||||||
.ok_or_else(|| anyhow::anyhow!("Division by zero or overflow"))?
|
.ok_or_else(|| anyhow::anyhow!("Division by zero or overflow"))?;
|
||||||
.round_dp(8);
|
let exchange_rate_str = format!("{} XMR/BTC", exchange_rate.round_dp(8));
|
||||||
let exchange_rate_str = format!("{} XMR/BTC", exchange_rate);
|
|
||||||
|
|
||||||
let swap_data = json!({
|
let swap_data = json!({
|
||||||
"swap_id": swap_id.to_string(),
|
"swap_id": swap_id.to_string(),
|
||||||
|
|
|
@ -267,11 +267,10 @@ async fn main() -> Result<()> {
|
||||||
let swap_start_date = db.get_swap_start_date(swap_id).await?;
|
let swap_start_date = db.get_swap_start_date(swap_id).await?;
|
||||||
let peer_id = db.get_peer_id(swap_id).await?;
|
let peer_id = db.get_peer_id(swap_id).await?;
|
||||||
|
|
||||||
let exchange_rate = Decimal::from_f64(btc_amount.to_btc())
|
let exchange_rate = Decimal::from_f64(state3.btc.to_btc())
|
||||||
.ok_or_else(|| anyhow::anyhow!("Failed to convert BTC amount to Decimal"))?
|
.ok_or_else(|| anyhow::anyhow!("Failed to convert BTC amount to Decimal"))?
|
||||||
.checked_div(xmr_amount.as_xmr())
|
.checked_div(state3.xmr.as_xmr())
|
||||||
.ok_or_else(|| anyhow::anyhow!("Division by zero or overflow"))?
|
.ok_or_else(|| anyhow::anyhow!("Division by zero or overflow"))?;
|
||||||
.round_dp(8);
|
|
||||||
let exchange_rate = format!("{} XMR/BTC", exchange_rate.round_dp(8));
|
let exchange_rate = format!("{} XMR/BTC", exchange_rate.round_dp(8));
|
||||||
|
|
||||||
if json {
|
if json {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue