aboutsummaryrefslogtreecommitdiff
path: root/src/init.cpp
diff options
context:
space:
mode:
authorPieter Wuille <[email protected]>2013-04-25 19:30:28 +0200
committerPieter Wuille <[email protected]>2013-04-25 19:36:10 +0200
commit360cfe142c552ac5c4d904a1e970390188151ca8 (patch)
tree4e8232b61d597b9720cbb98a54d07690324b6c3b /src/init.cpp
parentMerge pull request #2554 from fanquake/qt-pro-brew-patch (diff)
downloaddiscoin-360cfe142c552ac5c4d904a1e970390188151ca8.tar.xz
discoin-360cfe142c552ac5c4d904a1e970390188151ca8.zip
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.cpp10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/init.cpp b/src/init.cpp
index f6485c3b1..f35979bc0 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());