Merge 2.0.0 branch into master (#164)

* create 2.0.0 branch

* V0/V1 Slate Removal + Grin Header Version Bump (#140)

* Remove V0 and V1 Slates from Wallet

* rustfmt

* V1 API + V2 wallet to wallet impl (#144)

* remove v1 API

* rustfmt

* convert http adapter to use V2 api

* rustfmt

* V2 API conversion Pt2 - Check version (#146)

* call check_version on wallet before http send

* rustfmt

* Support new Bulletproof rewind scheme (#122)

* Restore with LegacyProofBuilder

* Switch to ProofBuilder at HF block

* Switch proof builder for coinbase outputs at hard fork

* Use valid_header_version to switch proof builder

* Fix compilation errors

* Use legacy proof builder for AutomatedTesting chain type

* Add macro to avoid duplicate code

* Read version info from server, react accordingly (#154)

* read and parse version, bump hf

* rustfmt

* add foreign api middleware check

* rustfmt

* add middleware checks

* rustfmt

* add check for incoming pre-hf slates

* api tests

* Add double rewind period (#155)

* Add double rewind period

* Simplify restore

* Fix comment

* bump imported version for beta release

* version bump for next (potential) release

* Provide more specific error when other wallet is outdated (#162)

* add appropriate error message when other wallet is out of date

* rustfmt

* missing cargo.lock
This commit is contained in:
Yeastplume
2019-06-27 10:41:05 +01:00
committed by GitHub
parent c7a00478aa
commit 64e8c48c35
37 changed files with 935 additions and 4061 deletions
+19 -19
View File
@@ -18,10 +18,13 @@ use clap::ArgMatches;
use grin_wallet_config::WalletConfig;
use grin_wallet_impls::{HTTPNodeClient, WalletSeed, SEED_FILE};
use grin_wallet_libwallet::NodeClient;
use semver::Version;
use std::path::PathBuf;
use std::thread;
use std::time::Duration;
const MIN_COMPAT_NODE_VERSION: &str = "2.0.0-beta.1";
pub fn _init_wallet_seed(wallet_config: WalletConfig, password: &str) {
if let Err(_) = WalletSeed::from_file(&wallet_config, password) {
WalletSeed::init_file(&wallet_config, 32, None, password)
@@ -44,32 +47,29 @@ pub fn wallet_command(wallet_args: &ArgMatches<'_>, config: GlobalWalletConfig)
// just get defaults from the global config
let wallet_config = config.members.unwrap().wallet;
// 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
// Check the node version info, and exit with report if we're not compatible
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!("{}", err_str);
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;
}
// This will also cache the node version info for calls to foreign API check middleware
if let Some(v) = node_client.clone().get_version_info() {
// Isn't going to happen just yet (as of 2.0.0) but keep this here for
// the future. the nodeclient's get_version_info will return 1.0 if
// it gets a 404 for the version function
if Version::parse(&v.node_version) < Version::parse(MIN_COMPAT_NODE_VERSION) {
let version = if v.node_version == "1.0.0" {
"1.0.x series"
} else {
&v.node_version
};
println!("Specified Grin Node (version {}) is outdated and incompatible with this wallet version", version);
println!("Please update the node or use a different one");
return 1;
}
// just continue if can't connect to node, as user won't be able to do
// anything meaninful anyhow
Err(_) => {}
}
// ... if node isn't available, allow offline functions
let res = wallet_args::wallet_command(wallet_args, wallet_config, node_client);
+1 -1
View File
@@ -467,7 +467,7 @@ pub fn parse_send_args(args: &ArgMatches) -> Result<command::SendArgs, ParseErro
let v = parse_required(args, "slate_version")?;
Some(parse_u64(v, "slate_version")? as u16)
}
false => Some(0),
false => None,
}
};
+1 -1
View File
@@ -1,5 +1,5 @@
name: grin-wallet
version: "1.1.1-beta.1"
version: "2.0.0-beta.2"
about: Reference Grin Wallet
author: The Grin Team