From 7637fba279fa9fc47da47ff7d8e5b993f823ec6e Mon Sep 17 00:00:00 2001 From: Dennis Netterdon Date: Tue, 29 Sep 2020 11:51:49 +0200 Subject: [PATCH] fix path of params --- lib/Cargo.toml | 4 ++++ lib/src/lib.rs | 2 +- lib/src/lightclient.rs | 11 +++++------ 3 files changed, 10 insertions(+), 7 deletions(-) diff --git a/lib/Cargo.toml b/lib/Cargo.toml index 9967a4b..9e7e41f 100644 --- a/lib/Cargo.toml +++ b/lib/Cargo.toml @@ -3,6 +3,10 @@ name = "silentdragonlitelib" version = "0.1.0" edition = "2018" +[features] +default = ["embed_params"] +embed_params = [] + [dependencies] base58 = "0.1.0" log = "0.4" diff --git a/lib/src/lib.rs b/lib/src/lib.rs index 96e8d52..99a6f36 100644 --- a/lib/src/lib.rs +++ b/lib/src/lib.rs @@ -6,7 +6,7 @@ pub mod grpcconnector; pub mod lightwallet; pub mod commands; - +#[cfg(feature = "embed_params")] #[derive(RustEmbed)] #[folder = "zcash-params/"] pub struct SaplingParams; diff --git a/lib/src/lightclient.rs b/lib/src/lightclient.rs index ee0aaf3..6154396 100644 --- a/lib/src/lightclient.rs +++ b/lib/src/lightclient.rs @@ -14,7 +14,6 @@ use std::io::{BufReader, BufWriter, Error, ErrorKind}; use protobuf::parse_from_bytes; - use threadpool::ThreadPool; use json::{object, array, JsonValue}; @@ -382,7 +381,7 @@ impl LightClient { #[allow(dead_code)] pub fn unconnected(seed_phrase: String, dir: Option) -> io::Result { let config = LightClientConfig::create_unconnected("test".to_string(), dir); - let l = LightClient { + let mut l = LightClient { wallet : Arc::new(RwLock::new(LightWallet::new(Some(seed_phrase), &config, 0,0 )?)), config : config.clone(), sapling_output : vec![], @@ -410,7 +409,7 @@ impl LightClient { "Cannot create a new wallet from seed, because a wallet already exists")); } - let l = LightClient { + let mut l = LightClient { wallet : Arc::new(RwLock::new(LightWallet::new(None, config, latest_block, 0)?)), config : config.clone(), sapling_output : vec![], @@ -437,7 +436,7 @@ impl LightClient { "Cannot create a new wallet from seed, because a wallet already exists")); } - let l = LightClient { + let mut l = LightClient { wallet : Arc::new(RwLock::new(LightWallet::new(Some(seed_phrase), config, birthday, number)?)), config : config.clone(), sapling_output : vec![], @@ -468,7 +467,7 @@ impl LightClient { let mut file_buffer = BufReader::new(File::open(config.get_wallet_path())?); let wallet = LightWallet::read(&mut file_buffer, config)?; - let lc = LightClient { + let mut lc = LightClient { wallet : Arc::new(RwLock::new(wallet)), config : config.clone(), sapling_output : vec![], @@ -478,7 +477,7 @@ impl LightClient { }; #[cfg(feature = "embed_params")] - l.read_sapling_params(); + lc.read_sapling_params(); info!("Read wallet with birthday {}", lc.wallet.read().unwrap().get_first_tx_block()); info!("Created LightClient to {}", &config.server);