Don't spam the user while waiting for BTC

This commit is contained in:
Thomas Eizinger 2021-07-08 12:14:30 +10:00
parent 56a48e71ef
commit cacfc50fb2
No known key found for this signature in database
GPG Key ID: 651AC83A6C6C8B96

View File

@ -446,28 +446,26 @@ where
"Waiting for Bitcoin deposit",
);
max_giveable = loop {
sync().await?;
let new_max_givable = max_giveable_fn().await?;
if new_max_givable != max_giveable {
max_giveable = new_max_givable;
let new_balance = balance().await?;
tracing::info!(
%new_balance,
%max_giveable,
"Received Bitcoin",
);
if max_giveable >= bid_quote.min_quantity {
break;
} else {
tracing::info!("Deposited amount is less than `min_quantity`",);
}
if new_max_givable > max_giveable {
break new_max_givable;
}
tokio::time::sleep(Duration::from_secs(1)).await;
};
let new_balance = balance().await?;
tracing::info!(%new_balance, %max_giveable, "Received Bitcoin");
if max_giveable < bid_quote.min_quantity {
tracing::info!("Deposited amount is less than `min_quantity`");
continue;
}
break;
}
};