Browse Source

Move CWallet::setKeyPool to private section of CWallet

0.14
Patrick Strateman 9 years ago
parent
commit
e86eb71604
  1. 9
      src/init.cpp
  2. 15
      src/wallet/wallet.h
  3. 10
      src/wallet/walletdb.cpp

9
src/init.cpp

@ -1439,9 +1439,12 @@ bool AppInit2(boost::thread_group& threadGroup, CScheduler& scheduler)
LogPrintf("mapBlockIndex.size() = %u\n", mapBlockIndex.size()); LogPrintf("mapBlockIndex.size() = %u\n", mapBlockIndex.size());
LogPrintf("nBestHeight = %d\n", chainActive.Height()); LogPrintf("nBestHeight = %d\n", chainActive.Height());
#ifdef ENABLE_WALLET #ifdef ENABLE_WALLET
LogPrintf("setKeyPool.size() = %u\n", pwalletMain ? pwalletMain->setKeyPool.size() : 0); if (pwalletMain) {
LogPrintf("mapWallet.size() = %u\n", pwalletMain ? pwalletMain->mapWallet.size() : 0); LOCK(pwalletMain->cs_wallet);
LogPrintf("mapAddressBook.size() = %u\n", pwalletMain ? pwalletMain->mapAddressBook.size() : 0); LogPrintf("setKeyPool.size() = %u\n", pwalletMain->GetKeyPoolSize());
LogPrintf("mapWallet.size() = %u\n", pwalletMain->mapWallet.size());
LogPrintf("mapAddressBook.size() = %u\n", pwalletMain->mapAddressBook.size());
}
#endif #endif
if (GetBoolArg("-listenonion", DEFAULT_LISTEN_ONION)) if (GetBoolArg("-listenonion", DEFAULT_LISTEN_ONION))

15
src/wallet/wallet.h

@ -582,6 +582,8 @@ private:
CHDChain hdChain; CHDChain hdChain;
bool fFileBacked; bool fFileBacked;
std::set<int64_t> setKeyPool;
public: public:
/* /*
* Main wallet lock. * Main wallet lock.
@ -594,7 +596,18 @@ public:
std::string strWalletFile; std::string strWalletFile;
std::set<int64_t> setKeyPool; void LoadKeyPool(int nIndex, const CKeyPool &keypool)
{
setKeyPool.insert(nIndex);
// If no metadata exists yet, create a default with the pool key's
// creation time. Note that this may be overwritten by actually
// stored metadata for that key later, which is fine.
CKeyID keyid = keypool.vchPubKey.GetID();
if (mapKeyMetadata.count(keyid) == 0)
mapKeyMetadata[keyid] = CKeyMetadata(keypool.nTime);
}
std::map<CKeyID, CKeyMetadata> mapKeyMetadata; std::map<CKeyID, CKeyMetadata> mapKeyMetadata;
typedef std::map<unsigned int, CMasterKey> MasterKeyMap; typedef std::map<unsigned int, CMasterKey> MasterKeyMap;

10
src/wallet/walletdb.cpp

@ -556,14 +556,8 @@ ReadKeyValue(CWallet* pwallet, CDataStream& ssKey, CDataStream& ssValue,
ssKey >> nIndex; ssKey >> nIndex;
CKeyPool keypool; CKeyPool keypool;
ssValue >> keypool; ssValue >> keypool;
pwallet->setKeyPool.insert(nIndex);
pwallet->LoadKeyPool(nIndex, keypool);
// If no metadata exists yet, create a default with the pool key's
// creation time. Note that this may be overwritten by actually
// stored metadata for that key later, which is fine.
CKeyID keyid = keypool.vchPubKey.GetID();
if (pwallet->mapKeyMetadata.count(keyid) == 0)
pwallet->mapKeyMetadata[keyid] = CKeyMetadata(keypool.nTime);
} }
else if (strType == "version") else if (strType == "version")
{ {

Loading…
Cancel
Save