From d3800d59d557388b813513ef16f6b840467821d4 Mon Sep 17 00:00:00 2001 From: Pieter Wuille Date: Sun, 26 Jun 2011 02:37:52 +0200 Subject: Fix segfault when creating new wallet The initialization of the default key used keyUser instead of vchDefaultKey. keyUser is now complete removed. --- src/wallet.cpp | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) (limited to 'src/wallet.cpp') diff --git a/src/wallet.cpp b/src/wallet.cpp index b06187a4b2..e35bce61ef 100644 --- a/src/wallet.cpp +++ b/src/wallet.cpp @@ -962,21 +962,15 @@ bool CWallet::LoadWallet(bool& fFirstRunRet) return false; fFirstRunRet = vchDefaultKey.empty(); - if (mapKeys.count(vchDefaultKey)) + if (!mapKeys.count(vchDefaultKey)) { - // Set keyUser - keyUser.SetPubKey(vchDefaultKey); - keyUser.SetPrivKey(mapKeys[vchDefaultKey]); - } - else - { - // Create new keyUser and set as default key + // Create new default key RandAddSeedPerfmon(); vchDefaultKey = GetKeyFromKeyPool(); if (!SetAddressBookName(PubKeyToAddress(vchDefaultKey), "")) return false; - CWalletDB(strWalletFile).WriteDefaultKey(keyUser.GetPubKey()); + CWalletDB(strWalletFile).WriteDefaultKey(vchDefaultKey); } CreateThread(ThreadFlushWalletDB, &strWalletFile); -- cgit v1.2.3