Browse Source

fix path of params

danger
Dennis Netterdon 4 years ago
parent
commit
7637fba279
  1. 4
      lib/Cargo.toml
  2. 2
      lib/src/lib.rs
  3. 11
      lib/src/lightclient.rs

4
lib/Cargo.toml

@ -3,6 +3,10 @@ name = "silentdragonlitelib"
version = "0.1.0" version = "0.1.0"
edition = "2018" edition = "2018"
[features]
default = ["embed_params"]
embed_params = []
[dependencies] [dependencies]
base58 = "0.1.0" base58 = "0.1.0"
log = "0.4" log = "0.4"

2
lib/src/lib.rs

@ -6,7 +6,7 @@ pub mod grpcconnector;
pub mod lightwallet; pub mod lightwallet;
pub mod commands; pub mod commands;
#[cfg(feature = "embed_params")]
#[derive(RustEmbed)] #[derive(RustEmbed)]
#[folder = "zcash-params/"] #[folder = "zcash-params/"]
pub struct SaplingParams; pub struct SaplingParams;

11
lib/src/lightclient.rs

@ -14,7 +14,6 @@ use std::io::{BufReader, BufWriter, Error, ErrorKind};
use protobuf::parse_from_bytes; use protobuf::parse_from_bytes;
use threadpool::ThreadPool; use threadpool::ThreadPool;
use json::{object, array, JsonValue}; use json::{object, array, JsonValue};
@ -382,7 +381,7 @@ impl LightClient {
#[allow(dead_code)] #[allow(dead_code)]
pub fn unconnected(seed_phrase: String, dir: Option<String>) -> io::Result<Self> { pub fn unconnected(seed_phrase: String, dir: Option<String>) -> io::Result<Self> {
let config = LightClientConfig::create_unconnected("test".to_string(), dir); 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 )?)), wallet : Arc::new(RwLock::new(LightWallet::new(Some(seed_phrase), &config, 0,0 )?)),
config : config.clone(), config : config.clone(),
sapling_output : vec![], sapling_output : vec![],
@ -410,7 +409,7 @@ impl LightClient {
"Cannot create a new wallet from seed, because a wallet already exists")); "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)?)), wallet : Arc::new(RwLock::new(LightWallet::new(None, config, latest_block, 0)?)),
config : config.clone(), config : config.clone(),
sapling_output : vec![], sapling_output : vec![],
@ -437,7 +436,7 @@ impl LightClient {
"Cannot create a new wallet from seed, because a wallet already exists")); "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)?)), wallet : Arc::new(RwLock::new(LightWallet::new(Some(seed_phrase), config, birthday, number)?)),
config : config.clone(), config : config.clone(),
sapling_output : vec![], sapling_output : vec![],
@ -468,7 +467,7 @@ impl LightClient {
let mut file_buffer = BufReader::new(File::open(config.get_wallet_path())?); let mut file_buffer = BufReader::new(File::open(config.get_wallet_path())?);
let wallet = LightWallet::read(&mut file_buffer, config)?; let wallet = LightWallet::read(&mut file_buffer, config)?;
let lc = LightClient { let mut lc = LightClient {
wallet : Arc::new(RwLock::new(wallet)), wallet : Arc::new(RwLock::new(wallet)),
config : config.clone(), config : config.clone(),
sapling_output : vec![], sapling_output : vec![],
@ -478,7 +477,7 @@ impl LightClient {
}; };
#[cfg(feature = "embed_params")] #[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!("Read wallet with birthday {}", lc.wallet.read().unwrap().get_first_tx_block());
info!("Created LightClient to {}", &config.server); info!("Created LightClient to {}", &config.server);

Loading…
Cancel
Save