mirror of
https://github.com/mimblewimble/grin-wallet.git
synced 2025-02-01 17:01:10 +03:00
Fix for API secret on node API startup (#131)
* fix for api_secret when reading node height * rustfmt * remove macro export * trigger ci again
This commit is contained in:
parent
cc940fb978
commit
03ab8ad8bd
1 changed files with 8 additions and 4 deletions
|
@ -17,6 +17,7 @@ use crate::config::GlobalWalletConfig;
|
||||||
use clap::ArgMatches;
|
use clap::ArgMatches;
|
||||||
use grin_wallet_config::WalletConfig;
|
use grin_wallet_config::WalletConfig;
|
||||||
use grin_wallet_impls::{HTTPNodeClient, WalletSeed, SEED_FILE};
|
use grin_wallet_impls::{HTTPNodeClient, WalletSeed, SEED_FILE};
|
||||||
|
use grin_wallet_libwallet::NodeClient;
|
||||||
use std::path::PathBuf;
|
use std::path::PathBuf;
|
||||||
use std::thread;
|
use std::thread;
|
||||||
use std::time::Duration;
|
use std::time::Duration;
|
||||||
|
@ -43,20 +44,23 @@ pub fn wallet_command(wallet_args: &ArgMatches<'_>, config: GlobalWalletConfig)
|
||||||
// just get defaults from the global config
|
// just get defaults from the global config
|
||||||
let wallet_config = config.members.unwrap().wallet;
|
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
|
// 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,
|
// All tx operations call get_chain_height as a first order of business,
|
||||||
// so this is the most non-intrusive place to put this
|
// 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() {
|
match node_client.clone().chain_height() {
|
||||||
Ok(h) => {
|
Ok(h) => {
|
||||||
if h >= 262080 {
|
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";
|
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);
|
error!("{}", err_str);
|
||||||
println!();
|
println!();
|
||||||
println!("**************");
|
println!("***************");
|
||||||
println!("{}", err_str);
|
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!("(You can still view your balances by disconnecting from the grin node, however you will not be able to transact until you upgrade)");
|
||||||
println!();
|
println!();
|
||||||
return 1;
|
return 1;
|
||||||
|
|
Loading…
Reference in a new issue