mirror of
https://github.com/Qortal/piratewallet-light-cli.git
synced 2025-02-01 03:12:15 +00:00
Don't fix bug when no money is involved.
This commit is contained in:
parent
94e70cc3f7
commit
5cf2c955e3
@ -235,7 +235,7 @@ impl Command for EncryptCommand {
|
|||||||
use crate::lightwallet::bugs::BugBip39Derivation;
|
use crate::lightwallet::bugs::BugBip39Derivation;
|
||||||
if BugBip39Derivation::has_bug(lightclient) {
|
if BugBip39Derivation::has_bug(lightclient) {
|
||||||
let mut h = vec![];
|
let mut h = vec![];
|
||||||
h.push("It looks like your wallet has the bop39bug. Please run 'fixbip39bug' to fix it");
|
h.push("It looks like your wallet has the bip39bug. Please run 'fixbip39bug' to fix it");
|
||||||
h.push("before encrypting your wallet.");
|
h.push("before encrypting your wallet.");
|
||||||
h.push("ERROR: Cannot encrypt while wallet has the bip39bug.");
|
h.push("ERROR: Cannot encrypt while wallet has the bip39bug.");
|
||||||
return h.join("\n");
|
return h.join("\n");
|
||||||
|
@ -73,13 +73,12 @@ impl BugBip39Derivation {
|
|||||||
println!("Sending funds to ourself.");
|
println!("Sending funds to ourself.");
|
||||||
let zaddr = client.do_address()["z_addresses"][0].as_str().unwrap().to_string();
|
let zaddr = client.do_address()["z_addresses"][0].as_str().unwrap().to_string();
|
||||||
let balance_json = client.do_balance();
|
let balance_json = client.do_balance();
|
||||||
let fee: u64 = DEFAULT_FEE.try_into().unwrap();
|
|
||||||
let amount: u64 = balance_json["zbalance"].as_u64().unwrap()
|
let amount: u64 = balance_json["zbalance"].as_u64().unwrap()
|
||||||
+ balance_json["tbalance"].as_u64().unwrap()
|
+ balance_json["tbalance"].as_u64().unwrap();
|
||||||
- fee;
|
|
||||||
|
|
||||||
let txid = if amount > 0 {
|
let txid = if amount > 0 {
|
||||||
match client.do_send(vec![(&zaddr, amount, None)]) {
|
let fee: u64 = DEFAULT_FEE.try_into().unwrap();
|
||||||
|
match client.do_send(vec![(&zaddr, amount-fee, None)]) {
|
||||||
Ok(txid) => txid,
|
Ok(txid) => txid,
|
||||||
Err(e) => {
|
Err(e) => {
|
||||||
let r = object!{
|
let r = object!{
|
||||||
|
Loading…
Reference in New Issue
Block a user