Skip to content
This repository has been archived by the owner on Jul 27, 2022. It is now read-only.

Problem: client-cli history/balance may display outdated information #1051

Merged
merged 1 commit into from
Feb 11, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion client-cli/src/command.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ use cli_table::format::{CellFormat, Color, Justify};
use cli_table::{Cell, Row, Table};
use hex::encode;
use pbr::ProgressBar;
use quest::success;
use quest::{ask, success};
use structopt::StructOpt;

use chain_core::init::coin::Coin;
Expand Down Expand Up @@ -418,6 +418,8 @@ impl Command {

fn get_balance<T: WalletClient>(wallet_client: T, name: &str) -> Result<()> {
let enckey = ask_seckey(None)?;
print_sync_warning();

let balance = wallet_client.balance(name, &enckey)?;

let rows = vec![
Expand Down Expand Up @@ -454,6 +456,8 @@ impl Command {
reversed: bool,
) -> Result<()> {
let enckey = ask_seckey(None)?;
print_sync_warning();

let history = wallet_client.history(name, &enckey, offset, limit, reversed)?;

if !history.is_empty() {
Expand Down Expand Up @@ -572,3 +576,8 @@ impl Command {
Ok(())
}
}

fn print_sync_warning() {
ask("Warning! Information displayed here may be outdated. To get the latest information, do `client-cli sync --name <wallet name>`");
println!();
}