mirror of
https://github.com/mimblewimble/grin.git
synced 2025-02-01 17:01:09 +03:00
fixing issue where wallet outputs become spent when api server doesn't exist (#242)
This commit is contained in:
parent
024a016bce
commit
5b47da907f
2 changed files with 10 additions and 2 deletions
|
@ -96,7 +96,11 @@ pub fn refresh_outputs(config: &WalletConfig, keychain: &Keychain) -> Result<(),
|
||||||
Ok(outputs) => for out in outputs {
|
Ok(outputs) => for out in outputs {
|
||||||
api_outputs.insert(out.commit, out);
|
api_outputs.insert(out.commit, out);
|
||||||
},
|
},
|
||||||
Err(_) => {}
|
Err(e) => {
|
||||||
|
// if we got anything other than 200 back from server, don't attempt to refresh the wallet
|
||||||
|
// data after
|
||||||
|
return Err(Error::Node(e));
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
// now for each commit, find the output in the wallet and
|
// now for each commit, find the output in the wallet and
|
||||||
|
|
|
@ -19,7 +19,7 @@ use types::{WalletConfig, WalletData};
|
||||||
|
|
||||||
pub fn show_info(config: &WalletConfig, keychain: &Keychain) {
|
pub fn show_info(config: &WalletConfig, keychain: &Keychain) {
|
||||||
let root_key_id = keychain.root_key_id();
|
let root_key_id = keychain.root_key_id();
|
||||||
let _ = checker::refresh_outputs(&config, &keychain);
|
let result = checker::refresh_outputs(&config, &keychain);
|
||||||
|
|
||||||
// just read the wallet here, no need for a write lock
|
// just read the wallet here, no need for a write lock
|
||||||
let _ = WalletData::read_wallet(&config.data_file_dir, |wallet_data| {
|
let _ = WalletData::read_wallet(&config.data_file_dir, |wallet_data| {
|
||||||
|
@ -56,4 +56,8 @@ pub fn show_info(config: &WalletConfig, keychain: &Keychain) {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
if let Err(e) = result {
|
||||||
|
println!("WARNING - Showing local data only - Wallet was unable to contact a node to update and verify the outputs shown here.");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue