Skip to content

Commit

Permalink
Fix for API secret on node API startup (mimblewimble#131)
Browse files Browse the repository at this point in the history
* fix for api_secret when reading node height

* rustfmt

* remove macro export

* trigger ci again
  • Loading branch information
yeastplume authored Jun 1, 2019
1 parent cc940fb commit 03ab8ad
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions src/bin/cmd/wallet.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;
Expand Down

0 comments on commit 03ab8ad

Please sign in to comment.