mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-07-05 05:02:06 +02:00
Allow the default key to be unavailable
This solves the issue where no default key can be added after -salvagewallet.
This commit is contained in:
committed by
Pieter Wuille
parent
77a1e12eed
commit
360cfe142c
10
src/init.cpp
10
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());
|
||||
|
Reference in New Issue
Block a user