Refresh coinbase key if the existing one was removed (#2493)

* Refresh coinbase key if the existing was removed

It happens if `wallet check` runs in parallel.
Alternative solution is not to remove it during the check.
Fixes #2412
This commit is contained in:
hashmap 2019-01-31 13:00:44 +01:00 committed by GitHub
parent 0c851c5140
commit 062d41766e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 2 deletions

View file

@ -104,7 +104,7 @@ pub enum ErrorKind {
CallbackImpl(&'static str),
/// Wallet backend error
#[fail(display = "Wallet store error")]
#[fail(display = "Wallet store error: {}", _0)]
Backend(String),
/// Callback implementation error conversion

View file

@ -473,7 +473,10 @@ where
let parent_key_id = wallet.parent_key_id();
let key_id = match key_id {
Some(key_id) => keys::retrieve_existing_key(wallet, key_id, None)?.0,
Some(key_id) => match keys::retrieve_existing_key(wallet, key_id, None) {
Ok(k) => k.0,
Err(_) => keys::next_available_key(wallet)?,
},
None => keys::next_available_key(wallet)?,
};