Refactor: Allow LegacyScriptPubKeyMan to be null

In CWallet::LoadWallet, use this to detect and empty wallet with no keys

This commit does not change behavior.
This commit is contained in:
Andrew Chow committed 2020-01-23 16:34:28 -05:00
1 parent fadc08ad94
commit eb81fc3ee5
15 files changed
+86 -37

No files matched your search

+1
View File
@@ -59,6 +59,7 @@ void TestAddAddressesToSendBook(interfaces::Node& node)
{
TestChain100Setup test;
std::shared_ptr<CWallet> wallet = std::make_shared<CWallet>(node.context()->chain.get(), WalletLocation(), WalletDatabase::CreateMock());
wallet->SetupLegacyScriptPubKeyMan();
bool firstRun;
wallet->LoadWallet(firstRun);
+1 -1
View File
@@ -143,7 +143,7 @@ void TestGUI(interfaces::Node& node)
bool firstRun;
wallet->LoadWallet(firstRun);
{
auto spk_man = wallet->GetLegacyScriptPubKeyMan();
auto spk_man = wallet->GetOrCreateLegacyScriptPubKeyMan();
auto locked_chain = wallet->chain().lock();
LOCK2(wallet->cs_wallet, spk_man->cs_KeyStore);
wallet->SetAddressBook(GetDestinationForKey(test.coinbaseKey.GetPubKey(), wallet->m_default_address_type), "", "receive");