trade: fix not saving new tokens if there are no available confirmations (#220)

This commit is contained in:
Carson McManus 2023-06-24 13:02:54 -04:00 committed by GitHub
parent 7e04a4240a
commit 64697b6808
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 2 deletions

View file

@ -39,7 +39,7 @@ impl AccountCommand for TradeCommand {
crate::do_login(&mut account)?; crate::do_login(&mut account)?;
} }
info!("Checking for trade confirmations"); info!("{}: Checking for trade confirmations", account.account_name);
let confirmations: Vec<Confirmation>; let confirmations: Vec<Confirmation>;
loop { loop {
match account.get_trade_confirmations() { match account.get_trade_confirmations() {
@ -55,6 +55,11 @@ impl AccountCommand for TradeCommand {
} }
} }
if confirmations.is_empty() {
info!("{}: No confirmations", account.account_name);
continue;
}
let mut any_failed = false; let mut any_failed = false;
if self.accept_all { if self.accept_all {
info!("accepting all confirmations"); info!("accepting all confirmations");

View file

@ -84,7 +84,7 @@ pub(crate) fn prompt_confirmation_menu(
confirmations: Vec<Confirmation>, confirmations: Vec<Confirmation>,
) -> anyhow::Result<(Vec<Confirmation>, Vec<Confirmation>)> { ) -> anyhow::Result<(Vec<Confirmation>, Vec<Confirmation>)> {
if confirmations.is_empty() { if confirmations.is_empty() {
bail!("no confirmations") return Ok((vec![], vec![]));
} }
let mut to_accept_idx: HashSet<usize> = HashSet::new(); let mut to_accept_idx: HashSet<usize> = HashSet::new();