diff --git a/src/bin/cmd/wallet.rs b/src/bin/cmd/wallet.rs index 96246b09..707b9798 100644 --- a/src/bin/cmd/wallet.rs +++ b/src/bin/cmd/wallet.rs @@ -17,6 +17,7 @@ use crate::config::GlobalWalletConfig; use clap::ArgMatches; use grin_wallet_config::WalletConfig; use grin_wallet_impls::{HTTPNodeClient, WalletSeed, SEED_FILE}; +use grin_wallet_libwallet::NodeClient; use std::path::PathBuf; use std::thread; use std::time::Duration; @@ -43,20 +44,23 @@ pub fn wallet_command(wallet_args: &ArgMatches<'_>, config: GlobalWalletConfig) // just get defaults from the global config let wallet_config = config.members.unwrap().wallet; - let node_client = HTTPNodeClient::new(&wallet_config.check_node_api_http_addr, None); - // TODO: Very temporary code to obsolete grin wallet for the first hard fork // All tx operations call get_chain_height as a first order of business, // so this is the most non-intrusive place to put this + let mut node_client = HTTPNodeClient::new(&wallet_config.check_node_api_http_addr, None); + let global_wallet_args = wallet_args::parse_global_args(&wallet_config, &wallet_args) + .expect("Can't read configuration file"); + node_client.set_node_api_secret(global_wallet_args.node_api_secret.clone()); + match node_client.clone().chain_height() { Ok(h) => { if h >= 262080 { let err_str = "This version of grin-wallet is obsolete as of block 252080. Please download v2.0.0 from https://github.com/mimblewimble/grin-wallet/releases"; error!("{}", err_str); println!(); - println!("**************"); + println!("***************"); println!("{}", err_str); - println!("**************"); + println!("***************"); println!("(You can still view your balances by disconnecting from the grin node, however you will not be able to transact until you upgrade)"); println!(); return 1;