move api into separate crate, integration tests working

This commit is contained in:
yeastplume 2019-02-14 13:40:29 +00:00
parent 9038c74248
commit 1f613c0641
No known key found for this signature in database
GPG key ID: AE6E005DF6E76B95
22 changed files with 230 additions and 96 deletions

36
Cargo.lock generated
View file

@ -574,6 +574,39 @@ dependencies = [
"url 1.7.2 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "grin_apiwallet"
version = "1.1.0"
dependencies = [
"blake2-rfc 0.2.18 (registry+https://github.com/rust-lang/crates.io-index)",
"chrono 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)",
"failure 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)",
"failure_derive 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)",
"futures 0.1.25 (registry+https://github.com/rust-lang/crates.io-index)",
"grin_api 1.1.0",
"grin_chain 1.1.0",
"grin_core 1.1.0",
"grin_keychain 1.1.0",
"grin_libwallet 1.1.0",
"grin_store 1.1.0",
"grin_util 1.1.0",
"grin_wallet_config 1.1.0",
"hyper 0.12.19 (registry+https://github.com/rust-lang/crates.io-index)",
"log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)",
"prettytable-rs 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
"rand 0.5.6 (registry+https://github.com/rust-lang/crates.io-index)",
"ring 0.13.5 (registry+https://github.com/rust-lang/crates.io-index)",
"serde 1.0.87 (registry+https://github.com/rust-lang/crates.io-index)",
"serde_derive 1.0.87 (registry+https://github.com/rust-lang/crates.io-index)",
"serde_json 1.0.38 (registry+https://github.com/rust-lang/crates.io-index)",
"term 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)",
"tokio 0.1.11 (registry+https://github.com/rust-lang/crates.io-index)",
"tokio-core 0.1.17 (registry+https://github.com/rust-lang/crates.io-index)",
"tokio-retry 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
"url 1.7.2 (registry+https://github.com/rust-lang/crates.io-index)",
"uuid 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "grin_chain"
version = "1.1.0"
@ -653,6 +686,7 @@ dependencies = [
"grin_keychain 1.1.0",
"grin_store 1.1.0",
"grin_util 1.1.0",
"grin_wallet_config 1.1.0",
"log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)",
"rand 0.5.6 (registry+https://github.com/rust-lang/crates.io-index)",
"serde 1.0.87 (registry+https://github.com/rust-lang/crates.io-index)",
@ -707,6 +741,7 @@ dependencies = [
"failure_derive 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)",
"futures 0.1.25 (registry+https://github.com/rust-lang/crates.io-index)",
"grin_api 1.1.0",
"grin_apiwallet 1.1.0",
"grin_chain 1.1.0",
"grin_core 1.1.0",
"grin_keychain 1.1.0",
@ -797,6 +832,7 @@ dependencies = [
"failure_derive 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)",
"futures 0.1.25 (registry+https://github.com/rust-lang/crates.io-index)",
"grin_api 1.1.0",
"grin_apiwallet 1.1.0",
"grin_chain 1.1.0",
"grin_core 1.1.0",
"grin_keychain 1.1.0",

View file

@ -16,7 +16,7 @@ name = "grin-wallet"
path = "src/bin/grin-wallet.rs"
[workspace]
members = ["config", "libwallet", "refwallet"]
members = ["apiwallet", "config", "libwallet", "refwallet"]
[dependencies]
clap = { version = "2.31", features = ["yaml"] }
@ -44,6 +44,7 @@ uuid = { version = "0.6", features = ["serde", "v4"] }
url = "1.7.0"
chrono = { version = "0.4.4", features = ["serde"] }
grin_apiwallet = { path = "./apiwallet", version = "1.1.0" }
grin_libwallet = { path = "./libwallet", version = "1.1.0" }
grin_refwallet = { path = "./refwallet", version = "1.1.0" }
grin_wallet_config = { path = "./config", version = "1.1.0" }

44
apiwallet/Cargo.toml Normal file
View file

@ -0,0 +1,44 @@
[package]
name = "grin_apiwallet"
version = "1.1.0"
authors = ["Grin Developers <mimblewimble@lists.launchpad.net>"]
description = "Simple, private and scalable cryptocurrency implementation based on the MimbleWimble chain format."
license = "Apache-2.0"
repository = "https://github.com/mimblewimble/grin"
keywords = [ "crypto", "grin", "mimblewimble" ]
readme = "README.md"
exclude = ["**/*.grin", "**/*.grin2"]
#build = "src/build/build.rs"
edition = "2018"
[dependencies]
blake2-rfc = "0.2"
failure = "0.1"
failure_derive = "0.1"
futures = "0.1"
hyper = "0.12"
rand = "0.5"
serde = "1"
serde_derive = "1"
serde_json = "1"
log = "0.4"
prettytable-rs = "0.7"
ring = "0.13"
term = "0.5"
tokio = "= 0.1.11"
tokio-core = "0.1"
tokio-retry = "0.1"
uuid = { version = "0.6", features = ["serde", "v4"] }
url = "1.7.0"
chrono = { version = "0.4.4", features = ["serde"] }
grin_libwallet = { path = "../libwallet", version = "1.1.0" }
grin_wallet_config = { path = "../config", version = "1.1.0" }
#grin_refwallet = { path = "../refwallet", version = "1.1.0" }
grin_core = { path = "../../grin/core", version = "1.1.0" }
grin_keychain = { path = "../../grin/keychain", version = "1.1.0" }
grin_chain = { path = "../../grin/chain", version = "1.1.0" }
grin_util = { path = "../../grin/util", version = "1.1.0" }
grin_api = { path = "../../grin/api", version = "1.1.0" }
grin_store = { path = "../../grin/store", version = "1.1.0" }

View file

@ -37,16 +37,16 @@ use uuid::Uuid;
use crate::core::core::hash::Hashed;
use crate::core::core::Transaction;
use crate::core::ser;
use crate::internal::{keys, tx, updater};
use crate::libwallet::internal::{keys, tx, updater};
use crate::keychain::{Identifier, Keychain};
use crate::slate::Slate;
use crate::types::{
use crate::libwallet::slate::Slate;
use crate::libwallet::types::{
AcctPathMapping, BlockFees, CbData, NodeClient, OutputData, OutputLockFn, TxLogEntry,
TxLogEntryType, TxWrapper, WalletBackend, WalletInfo,
};
use crate::util;
use crate::util::secp::{pedersen, ContextFlag, Secp256k1};
use crate::{Error, ErrorKind};
use crate::libwallet::{Error, ErrorKind};
const USER_MESSAGE_MAX_LEN: usize = 256;
@ -87,7 +87,8 @@ where
///
/// # Example
/// ```
/// # extern crate grin_wallet as wallet;
/// # extern crate grin_wallet_config as config;
/// # extern crate grin_refwallet as wallet;
/// # extern crate grin_keychain as keychain;
/// # extern crate grin_util as util;
///
@ -98,7 +99,8 @@ where
/// use wallet::libwallet::api::APIOwner;
///
/// // These contain sample implementations of each part needed for a wallet
/// use wallet::{LMDBBackend, HTTPNodeClient, WalletBackend, WalletConfig};
/// use wallet::{LMDBBackend, HTTPNodeClient, WalletBackend};
/// use config::WalletConfig;
///
/// let mut wallet_config = WalletConfig::default();
/// # wallet_config.data_file_dir = "test_output/doc/wallet1".to_owned();
@ -142,14 +144,16 @@ where
/// # Example
/// Set up as in [`new`](struct.APIOwner.html#method.new) method above.
/// ```
/// # extern crate grin_wallet as wallet;
/// # extern crate grin_wallet_config as config;
/// # extern crate grin_refwallet as wallet;
/// # extern crate grin_keychain as keychain;
/// # extern crate grin_util as util;
/// # use std::sync::Arc;
/// # use util::Mutex;
/// # use keychain::ExtKeychain;
/// # use wallet::libwallet::api::APIOwner;
/// # use wallet::{LMDBBackend, HTTPNodeClient, WalletBackend, WalletConfig};
/// # use wallet::{LMDBBackend, HTTPNodeClient, WalletBackend};
/// # use config::WalletConfig;
/// # let mut wallet_config = WalletConfig::default();
/// # wallet_config.data_file_dir = "test_output/doc/wallet1".to_owned();
/// # let node_client = HTTPNodeClient::new(&wallet_config.check_node_api_http_addr, None);

37
apiwallet/src/lib.rs Normal file
View file

@ -0,0 +1,37 @@
// Copyright 2019 The Grin Developers
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//! Higher level wallet functions which can be used by callers to operate
//! on the wallet, as well as helpers to invoke and instantiate wallets
//! and listeners
#![deny(non_upper_case_globals)]
#![deny(non_camel_case_types)]
#![deny(non_snake_case)]
#![deny(unused_mut)]
#![warn(missing_docs)]
extern crate grin_core as core;
extern crate grin_keychain as keychain;
extern crate grin_store as store;
extern crate grin_util as util;
extern crate grin_libwallet as libwallet;
use failure;
extern crate failure_derive;
#[macro_use]
extern crate log;
pub mod api;

View file

@ -27,3 +27,6 @@ grin_store = { path = "../../grin/store", version = "1.1.0" }
grin_core = { path = "../../grin/core", version = "1.1.0" }
grin_keychain = { path = "../../grin/keychain", version = "1.1.0" }
grin_util = { path = "../../grin/util", version = "1.1.0" }
[dev-dependencies]
grin_wallet_config = { path = "../config", version = "1.1.0" }

View file

@ -39,7 +39,6 @@ extern crate serde_derive;
#[macro_use]
extern crate log;
pub mod api;
mod error;
pub mod internal;
pub mod slate;

View file

@ -17,12 +17,10 @@ use self::core::libtx::{aggsig, proof};
use self::keychain::{BlindSum, BlindingFactor, ExtKeychain, Keychain};
use self::util::secp;
use self::util::secp::key::{PublicKey, SecretKey};
use self::wallet::libwallet::types::Context;
use self::wallet::{EncryptedWalletSeed, WalletSeed};
use grin_libwallet::types::Context;
use grin_core as core;
use grin_keychain as keychain;
use grin_util as util;
use grin_wallet as wallet;
use rand::thread_rng;
fn kernel_sig_msg() -> secp::Message {
@ -500,22 +498,3 @@ fn test_rewind_range_proof() {
assert_eq!(proof_info.success, false);
assert_eq!(proof_info.value, 0);
}
#[test]
fn wallet_seed_encrypt() {
let password = "passwoid";
let wallet_seed = WalletSeed::init_new(32);
let mut enc_wallet_seed = EncryptedWalletSeed::from_seed(&wallet_seed, password).unwrap();
println!("EWS: {:?}", enc_wallet_seed);
let decrypted_wallet_seed = enc_wallet_seed.decrypt(password).unwrap();
assert_eq!(wallet_seed, decrypted_wallet_seed);
// Wrong password
let decrypted_wallet_seed = enc_wallet_seed.decrypt("");
assert!(decrypted_wallet_seed.is_err());
// Wrong nonce
enc_wallet_seed.nonce = "wrongnonce".to_owned();
let decrypted_wallet_seed = enc_wallet_seed.decrypt(password);
assert!(decrypted_wallet_seed.is_err());
}

View file

@ -32,6 +32,7 @@ uuid = { version = "0.6", features = ["serde", "v4"] }
url = "1.7.0"
chrono = { version = "0.4.4", features = ["serde"] }
grin_apiwallet = { path = "../apiwallet", version = "1.1.0" }
grin_libwallet = { path = "../libwallet", version = "1.1.0" }
grin_wallet_config = { path = "../config", version = "1.1.0" }

View file

@ -21,7 +21,7 @@ use crate::api::{ApiServer, BasicAuthMiddleware, Handler, ResponseFuture, Router
use crate::core::core;
use crate::core::core::Transaction;
use crate::keychain::Keychain;
use crate::libwallet::api::{APIForeign, APIOwner};
use crate::apiwallet::api::{APIForeign, APIOwner};
use crate::libwallet::slate::{Slate, VersionedSlate};
use crate::libwallet::types::{
CbData, NodeClient, OutputData, SendTXArgs, TxLogEntry, WalletBackend, WalletInfo,

View file

@ -28,6 +28,7 @@ use grin_api as api;
extern crate grin_core as core;
use grin_keychain as keychain;
use grin_libwallet as libwallet;
use grin_apiwallet as apiwallet;
use grin_store as store;
use grin_util as util;
extern crate grin_wallet_config as config;

View file

@ -17,7 +17,7 @@ use self::core::core::{OutputFeatures, OutputIdentifier, Transaction};
use self::core::{consensus, global, pow, ser};
use self::util::secp::pedersen;
use self::util::Mutex;
use crate::libwallet::api::APIOwner;
use crate::apiwallet::api::APIOwner;
use crate::libwallet::types::{BlockFees, CbData, NodeClient, WalletInfo, WalletInst};
use crate::lmdb_wallet::LMDBBackend;
use crate::{controller, libwallet, WalletSeed};

View file

@ -14,20 +14,21 @@
//! tests differing accounts in the same wallet
#[macro_use]
extern crate log;
extern crate grin_refwallet as wallet;
use self::core::global;
use self::core::global::ChainTypes;
use self::keychain::{ExtKeychain, Keychain};
use self::wallet::libwallet;
use self::wallet::test_framework::{self, LocalWalletClient, WalletProxy};
use grin_core as core;
use grin_keychain as keychain;
use grin_util as util;
use grin_wallet as wallet;
use grin_libwallet as libwallet;
use wallet::test_framework::{self, LocalWalletClient, WalletProxy};
use std::fs;
use std::thread;
use std::time::Duration;
fn clean_output_dir(test_dir: &str) {
let _ = fs::remove_dir_all(test_dir);
}

View file

@ -14,17 +14,18 @@
//! tests differing accounts in the same wallet
#[macro_use]
extern crate log;
extern crate grin_refwallet as wallet;
use self::core::consensus;
use self::core::global;
use self::core::global::ChainTypes;
use self::keychain::ExtKeychain;
use self::wallet::test_framework::{self, LocalWalletClient, WalletProxy};
use self::wallet::{libwallet, FileWalletCommAdapter};
use wallet::FileWalletCommAdapter;
use grin_core as core;
use grin_keychain as keychain;
use grin_util as util;
use grin_wallet as wallet;
use grin_libwallet as libwallet;
use wallet::test_framework::{self, LocalWalletClient, WalletProxy};
use std::fs;
use std::thread;
use std::time::Duration;

View file

@ -0,0 +1,36 @@
// Copyright 2018 The Grin Developers
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//! core::libtx specific tests
extern crate grin_refwallet as wallet;
use self::wallet::{EncryptedWalletSeed, WalletSeed};
#[test]
fn wallet_seed_encrypt() {
let password = "passwoid";
let wallet_seed = WalletSeed::init_new(32);
let mut enc_wallet_seed = EncryptedWalletSeed::from_seed(&wallet_seed, password).unwrap();
println!("EWS: {:?}", enc_wallet_seed);
let decrypted_wallet_seed = enc_wallet_seed.decrypt(password).unwrap();
assert_eq!(wallet_seed, decrypted_wallet_seed);
// Wrong password
let decrypted_wallet_seed = enc_wallet_seed.decrypt("");
assert!(decrypted_wallet_seed.is_err());
// Wrong nonce
enc_wallet_seed.nonce = "wrongnonce".to_owned();
let decrypted_wallet_seed = enc_wallet_seed.decrypt(password);
assert!(decrypted_wallet_seed.is_err());
}

View file

@ -14,15 +14,17 @@
//! Test a wallet file send/recieve
#[macro_use]
extern crate log;
extern crate grin_refwallet as wallet;
use self::core::global;
use self::core::global::ChainTypes;
use self::keychain::ExtKeychain;
use self::wallet::test_framework::{self, LocalWalletClient, WalletProxy};
use self::wallet::{libwallet, FileWalletCommAdapter};
use self::wallet::FileWalletCommAdapter;
use grin_core as core;
use grin_keychain as keychain;
use grin_util as util;
use grin_wallet as wallet;
use grin_libwallet as libwallet;
use std::fs;
use std::thread;
use std::time::Duration;

View file

@ -14,17 +14,18 @@
//! Test a wallet repost command
#[macro_use]
extern crate log;
extern crate grin_refwallet as wallet;
extern crate grin_libwallet as libwallet;
use self::core::global;
use self::core::global::ChainTypes;
use self::keychain::ExtKeychain;
use self::libwallet::slate::Slate;
use self::wallet::test_framework::{self, LocalWalletClient, WalletProxy};
use self::wallet::{libwallet, FileWalletCommAdapter};
use self::wallet::FileWalletCommAdapter;
use grin_core as core;
use grin_keychain as keychain;
use grin_util as util;
use grin_wallet as wallet;
use std::fs;
use std::thread;
use std::time::Duration;

View file

@ -14,17 +14,18 @@
//! tests for wallet restore
#[macro_use]
extern crate log;
extern crate grin_refwallet as wallet;
extern crate grin_libwallet as libwallet;
use self::core::global;
use self::core::global::ChainTypes;
use self::keychain::{ExtKeychain, Identifier, Keychain};
use self::libwallet::slate::Slate;
use self::wallet::libwallet;
use self::wallet::libwallet::types::AcctPathMapping;
use self::libwallet::types::AcctPathMapping;
use self::wallet::test_framework::{self, LocalWalletClient, WalletProxy};
use grin_core as core;
use grin_keychain as keychain;
use grin_util as util;
use grin_wallet as wallet;
use std::fs;
use std::sync::atomic::Ordering;
use std::thread;

View file

@ -14,16 +14,16 @@
//! Test a wallet sending to self
#[macro_use]
extern crate log;
extern crate grin_refwallet as wallet;
use self::core::global;
use self::core::global::ChainTypes;
use self::keychain::ExtKeychain;
use self::wallet::libwallet;
use self::wallet::test_framework::{self, LocalWalletClient, WalletProxy};
use grin_core as core;
use grin_keychain as keychain;
use grin_util as util;
use grin_wallet as wallet;
use grin_libwallet as libwallet;
use std::fs;
use std::thread;
use std::time::Duration;

View file

@ -14,17 +14,18 @@
//! tests for transactions building within core::libtx
#[macro_use]
extern crate log;
extern crate grin_refwallet as wallet;
extern crate grin_libwallet as libwallet;
use self::core::global;
use self::core::global::ChainTypes;
use self::keychain::ExtKeychain;
use self::libwallet::slate::Slate;
use self::wallet::libwallet;
use self::wallet::libwallet::types::OutputStatus;
use self::libwallet::types::OutputStatus;
use self::wallet::test_framework::{self, LocalWalletClient, WalletProxy};
use grin_core as core;
use grin_keychain as keychain;
use grin_util as util;
use grin_wallet as wallet;
use std::fs;
use std::thread;
use std::time::Duration;

View file

@ -104,15 +104,13 @@ mod wallet_tests {
args: ArgMatches<'a>,
) -> ArgMatches<'a> {
match args.subcommand() {
("wallet", Some(wallet_args)) => {
("init", Some(init_args)) => {
// wallet init command should spit out its config file then continue
// (if desired)
if let ("init", Some(init_args)) = wallet_args.subcommand() {
if init_args.is_present("here") {
let _ = config_command_wallet(wallet_dir, wallet_name);
}
if init_args.is_present("here") {
let _ = config_command_wallet(wallet_dir, wallet_name);
}
wallet_args.to_owned()
init_args.to_owned()
}
_ => ArgMatches::new(),
}
@ -142,7 +140,7 @@ mod wallet_tests {
arg_vec: Vec<&str>,
) -> Result<String, grin_refwallet::Error> {
let args = app.clone().get_matches_from(arg_vec);
let args = get_wallet_subcommand(test_dir, wallet_name, args.clone());
let _ = get_wallet_subcommand(test_dir, wallet_name, args.clone());
let mut config = initial_setup_wallet(test_dir, wallet_name);
//unset chain type so it doesn't get reset
config.chain_type = None;
@ -162,7 +160,7 @@ mod wallet_tests {
let app = App::from_yaml(yml);
// wallet init
let arg_vec = vec!["grin", "wallet", "-p", "password", "init", "-h"];
let arg_vec = vec!["grin-wallet", "-p", "password", "init", "-h"];
// should create new wallet file
let client1 = LocalWalletClient::new("wallet1", wallet_proxy.tx.clone());
execute_command(&app, test_dir, "wallet1", &client1, arg_vec.clone())?;
@ -194,13 +192,12 @@ mod wallet_tests {
// Create some accounts in wallet 1
let arg_vec = vec![
"grin", "wallet", "-p", "password", "account", "-c", "mining",
"grin-wallet", "-p", "password", "account", "-c", "mining",
];
execute_command(&app, test_dir, "wallet1", &client1, arg_vec)?;
let arg_vec = vec![
"grin",
"wallet",
"grin-wallet",
"-p",
"password",
"account",
@ -211,8 +208,7 @@ mod wallet_tests {
// Create some accounts in wallet 2
let arg_vec = vec![
"grin",
"wallet",
"grin-wallet",
"-p",
"password",
"account",
@ -224,8 +220,7 @@ mod wallet_tests {
assert!(execute_command(&app, test_dir, "wallet2", &client2, arg_vec).is_err());
let arg_vec = vec![
"grin",
"wallet",
"grin-wallet",
"-p",
"password",
"account",
@ -235,11 +230,11 @@ mod wallet_tests {
execute_command(&app, test_dir, "wallet2", &client2, arg_vec)?;
// let's see those accounts
let arg_vec = vec!["grin", "wallet", "-p", "password", "account"];
let arg_vec = vec!["grin-wallet", "-p", "password", "account"];
execute_command(&app, test_dir, "wallet2", &client2, arg_vec)?;
// let's see those accounts
let arg_vec = vec!["grin", "wallet", "-p", "password", "account"];
let arg_vec = vec!["grin-wallet", "-p", "password", "account"];
execute_command(&app, test_dir, "wallet2", &client2, arg_vec)?;
// Mine a bit into wallet 1 so we have something to send
@ -264,15 +259,14 @@ mod wallet_tests {
This part should all be truncated";
// Update info and check
let arg_vec = vec!["grin", "wallet", "-p", "password", "-a", "mining", "info"];
let arg_vec = vec!["grin-wallet", "-p", "password", "-a", "mining", "info"];
execute_command(&app, test_dir, "wallet1", &client1, arg_vec)?;
// try a file exchange
let file_name = format!("{}/tx1.part_tx", test_dir);
let response_file_name = format!("{}/tx1.part_tx.response", test_dir);
let arg_vec = vec![
"grin",
"wallet",
"grin-wallet",
"-p",
"password",
"-a",
@ -289,8 +283,7 @@ mod wallet_tests {
execute_command(&app, test_dir, "wallet1", &client1, arg_vec)?;
let arg_vec = vec![
"grin",
"wallet",
"grin-wallet",
"-p",
"password",
"-a",
@ -307,8 +300,7 @@ mod wallet_tests {
assert!(execute_command(&app, test_dir, "wallet2", &client2, arg_vec).is_err());
let arg_vec = vec![
"grin",
"wallet",
"grin-wallet",
"-p",
"password",
"finalize",
@ -333,12 +325,11 @@ mod wallet_tests {
bh += 10;
// update info for each
let arg_vec = vec!["grin", "wallet", "-p", "password", "-a", "mining", "info"];
let arg_vec = vec!["grin-wallet", "-p", "password", "-a", "mining", "info"];
execute_command(&app, test_dir, "wallet1", &client1, arg_vec)?;
let arg_vec = vec![
"grin",
"wallet",
"grin-wallet",
"-p",
"password",
"-a",
@ -359,8 +350,7 @@ mod wallet_tests {
// Self-send to same account, using smallest strategy
let arg_vec = vec![
"grin",
"wallet",
"grin-wallet",
"-p",
"password",
"-a",
@ -379,8 +369,7 @@ mod wallet_tests {
execute_command(&app, test_dir, "wallet1", &client1, arg_vec)?;
let arg_vec = vec![
"grin",
"wallet",
"grin-wallet",
"-p",
"password",
"-a",
@ -394,8 +383,7 @@ mod wallet_tests {
execute_command(&app, test_dir, "wallet1", &client1, arg_vec.clone())?;
let arg_vec = vec![
"grin",
"wallet",
"grin-wallet",
"-p",
"password",
"finalize",
@ -418,8 +406,7 @@ mod wallet_tests {
// Try using the self-send method, splitting up outputs for the fun of it
let arg_vec = vec![
"grin",
"wallet",
"grin-wallet",
"-p",
"password",
"-a",
@ -453,8 +440,7 @@ mod wallet_tests {
// Another file exchange, don't send, but unlock with repair command
let arg_vec = vec![
"grin",
"wallet",
"grin-wallet",
"-p",
"password",
"-a",
@ -470,13 +456,12 @@ mod wallet_tests {
];
execute_command(&app, test_dir, "wallet1", &client1, arg_vec)?;
let arg_vec = vec!["grin", "wallet", "-p", "password", "check"];
let arg_vec = vec!["grin-wallet", "-p", "password", "check"];
execute_command(&app, test_dir, "wallet1", &client1, arg_vec)?;
// Another file exchange, cancel this time
let arg_vec = vec![
"grin",
"wallet",
"grin-wallet",
"-p",
"password",
"-a",
@ -493,23 +478,23 @@ mod wallet_tests {
execute_command(&app, test_dir, "wallet1", &client1, arg_vec)?;
let arg_vec = vec![
"grin", "wallet", "-p", "password", "-a", "mining", "cancel", "-i", "26",
"grin-wallet", "-p", "password", "-a", "mining", "cancel", "-i", "26",
];
execute_command(&app, test_dir, "wallet1", &client1, arg_vec)?;
// txs and outputs (mostly spit out for a visual in test logs)
let arg_vec = vec!["grin", "wallet", "-p", "password", "-a", "mining", "txs"];
let arg_vec = vec!["grin-wallet", "-p", "password", "-a", "mining", "txs"];
execute_command(&app, test_dir, "wallet1", &client1, arg_vec)?;
// message output (mostly spit out for a visual in test logs)
let arg_vec = vec![
"grin", "wallet", "-p", "password", "-a", "mining", "txs", "-i", "10",
"grin-wallet", "-p", "password", "-a", "mining", "txs", "-i", "10",
];
execute_command(&app, test_dir, "wallet1", &client1, arg_vec)?;
// txs and outputs (mostly spit out for a visual in test logs)
let arg_vec = vec![
"grin", "wallet", "-p", "password", "-a", "mining", "outputs",
"grin-wallet", "-p", "password", "-a", "mining", "outputs",
];
execute_command(&app, test_dir, "wallet1", &client1, arg_vec)?;

View file

@ -93,6 +93,7 @@ fn real_main() -> i32 {
let mut w = config::initial_setup_wallet(&chain_type).unwrap_or_else(|e| {
panic!("Error loading wallet configuration: {}", e);
});
if !cmd::seed_exists(w.members.as_ref().unwrap().wallet.clone()) {
if "init" == args.subcommand().0 || "recover" == args.subcommand().0 {
} else {