From 61dc063fe155d1510e9a074e5a3577a0621f8c3a Mon Sep 17 00:00:00 2001 From: Aditya Kulkarni Date: Wed, 13 Nov 2019 15:05:07 -0800 Subject: [PATCH] Sync before height command --- lib/src/commands.rs | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/lib/src/commands.rs b/lib/src/commands.rs index c052ff4..8f4f4f3 100644 --- a/lib/src/commands.rs +++ b/lib/src/commands.rs @@ -627,10 +627,13 @@ impl Command for HeightCommand { } fn exec(&self, _args: &[&str], lightclient: &LightClient) -> String { - format!("{}", - object! { - "height" => lightclient.last_scanned_height() - }.pretty(2)) + match lightclient.do_sync(true) { + Ok(_) => format!("{}", + object! { + "height" => lightclient.last_scanned_height() + }.pretty(2)), + Err(e) => e + } } }