aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorPatrick Strateman <patrick.strateman@gmail.com>2016-08-01 17:14:40 -0700
committerPatrick Strateman <patrick.strateman@gmail.com>2016-08-17 15:24:57 -0700
commite86eb71604e73ad35b8b1f59d73af22e353a156e (patch)
tree1e2c5327c62ef7ab427e46aa2a307f2ce6d77b58 /src
parentea268747b6d417a406977e9b4931badce29b9d7a (diff)
downloadbitcoin-e86eb71604e73ad35b8b1f59d73af22e353a156e.tar.xz
Move CWallet::setKeyPool to private section of CWallet
Diffstat (limited to 'src')
-rw-r--r--src/init.cpp9
-rw-r--r--src/wallet/wallet.h15
-rw-r--r--src/wallet/walletdb.cpp10
3 files changed, 22 insertions, 12 deletions
diff --git a/src/init.cpp b/src/init.cpp
index 8d4a2cafbf..a15fe2e13b 100644
--- a/src/init.cpp
+++ b/src/init.cpp
@@ -1439,9 +1439,12 @@ bool AppInit2(boost::thread_group& threadGroup, CScheduler& scheduler)
LogPrintf("mapBlockIndex.size() = %u\n", mapBlockIndex.size());
LogPrintf("nBestHeight = %d\n", chainActive.Height());
#ifdef ENABLE_WALLET
- LogPrintf("setKeyPool.size() = %u\n", pwalletMain ? pwalletMain->setKeyPool.size() : 0);
- LogPrintf("mapWallet.size() = %u\n", pwalletMain ? pwalletMain->mapWallet.size() : 0);
- LogPrintf("mapAddressBook.size() = %u\n", pwalletMain ? pwalletMain->mapAddressBook.size() : 0);
+ if (pwalletMain) {
+ LOCK(pwalletMain->cs_wallet);
+ LogPrintf("setKeyPool.size() = %u\n", pwalletMain->GetKeyPoolSize());
+ LogPrintf("mapWallet.size() = %u\n", pwalletMain->mapWallet.size());
+ LogPrintf("mapAddressBook.size() = %u\n", pwalletMain->mapAddressBook.size());
+ }
#endif
if (GetBoolArg("-listenonion", DEFAULT_LISTEN_ONION))
diff --git a/src/wallet/wallet.h b/src/wallet/wallet.h
index 50c94ccfbc..d2e3e2c6e3 100644
--- a/src/wallet/wallet.h
+++ b/src/wallet/wallet.h
@@ -582,6 +582,8 @@ private:
CHDChain hdChain;
bool fFileBacked;
+
+ std::set<int64_t> setKeyPool;
public:
/*
* Main wallet lock.
@@ -594,7 +596,18 @@ public:
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;
typedef std::map<unsigned int, CMasterKey> MasterKeyMap;
diff --git a/src/wallet/walletdb.cpp b/src/wallet/walletdb.cpp
index 543522ca64..025d3606d9 100644
--- a/src/wallet/walletdb.cpp
+++ b/src/wallet/walletdb.cpp
@@ -556,14 +556,8 @@ ReadKeyValue(CWallet* pwallet, CDataStream& ssKey, CDataStream& ssValue,
ssKey >> nIndex;
CKeyPool keypool;
ssValue >> keypool;
- pwallet->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 (pwallet->mapKeyMetadata.count(keyid) == 0)
- pwallet->mapKeyMetadata[keyid] = CKeyMetadata(keypool.nTime);
+
+ pwallet->LoadKeyPool(nIndex, keypool);
}
else if (strType == "version")
{