diff options
author | Pieter Wuille <pieter.wuille@gmail.com> | 2013-04-25 19:30:28 +0200 |
---|---|---|
committer | Pieter Wuille <pieterw@google.com> | 2013-04-25 19:36:10 +0200 |
commit | 360cfe142c552ac5c4d904a1e970390188151ca8 (patch) | |
tree | 4e8232b61d597b9720cbb98a54d07690324b6c3b /src/init.cpp | |
parent | 77a1e12eed5fc66dce16584696f54988a8c2bf4e (diff) |
Allow the default key to be unavailable
This solves the issue where no default key can be added after -salvagewallet.
Diffstat (limited to 'src/init.cpp')
-rw-r--r-- | src/init.cpp | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/src/init.cpp b/src/init.cpp index f6485c3b1d..f35979bc09 100644 --- a/src/init.cpp +++ b/src/init.cpp @@ -939,11 +939,11 @@ bool AppInit2(boost::thread_group& threadGroup) RandAddSeedPerfmon(); CPubKey newDefaultKey; - if (!pwalletMain->GetKeyFromPool(newDefaultKey, false)) - strErrors << _("Cannot initialize keypool") << "\n"; - pwalletMain->SetDefaultKey(newDefaultKey); - if (!pwalletMain->SetAddressBookName(pwalletMain->vchDefaultKey.GetID(), "")) - strErrors << _("Cannot write default address") << "\n"; + if (pwalletMain->GetKeyFromPool(newDefaultKey, false)) { + pwalletMain->SetDefaultKey(newDefaultKey); + if (!pwalletMain->SetAddressBookName(pwalletMain->vchDefaultKey.GetID(), "")) + strErrors << _("Cannot write default address") << "\n"; + } } printf("%s", strErrors.str().c_str()); |