Add bug warning

This commit is contained in:
Aditya Kulkarni 2019-10-20 13:40:54 -07:00
parent 085b8492ba
commit c1dd259caf
2 changed files with 19 additions and 0 deletions

View File

@ -42,6 +42,18 @@ pub struct LightClientConfig {
impl LightClientConfig {
// Create an unconnected (to any server) config to test for local wallet etc...
pub fn create_unconnected(chain_name: String) -> LightClientConfig {
LightClientConfig {
server : http::Uri::default(),
chain_name : chain_name,
sapling_activation_height : 0,
consensus_branch_id : "".to_string(),
anchor_offset : ANCHOR_OFFSET,
no_cert_verification : false,
}
}
pub fn create(server: http::Uri, dangerous: bool) -> io::Result<(LightClientConfig, u64)> {
// Do a getinfo first, before opening the wallet
let info = grpcconnector::get_info(server.clone(), dangerous)
@ -255,6 +267,12 @@ impl LightClient {
info!("Read wallet with birthday {}", lc.wallet.read().unwrap().get_first_tx_block());
info!("Created LightClient to {}", &config.server);
if crate::lightwallet::bugs::BugBip39Derivation::has_bug(&lc) {
let m = format!("WARNING!!!\nYour wallet has a bip39derivation bug that's showing incorrect addresses.\nPlease run 'fixbip39bug' to automatically fix the address derivation in your wallet!\nPlease see: https://github.com/adityapk00/zecwallet-light-cli/blob/master/bip39bug.md");
info!("{}", m);
println!("{}", m);
}
Ok(lc)
}

View File

@ -70,6 +70,7 @@ impl BugBip39Derivation {
// Tranfer money
// 1. The desination is z address #0
println!("Sending funds to ourself.");
let zaddr = client.do_address()["z_addresses"][0].as_str().unwrap().to_string();
let balance_json = client.do_balance();
let fee: u64 = DEFAULT_FEE.try_into().unwrap();