aboutsummaryrefslogtreecommitdiff
path: root/src/wallet
diff options
context:
space:
mode:
authorWladimir J. van der Laan <laanwj@gmail.com>2016-08-24 10:32:59 +0200
committerWladimir J. van der Laan <laanwj@gmail.com>2016-08-24 10:33:16 +0200
commitf9167003d947fa994cdd14406da79a1758acb7b3 (patch)
treeed03842a9672d119ec97c1a0f0a931f49e3f7319 /src/wallet
parent9358893518a19f38eab9186c768ad81c7a2f9cec (diff)
parent8680d3aa800aa4fab8c321b92cc7f3fa97a8a0a3 (diff)
downloadbitcoin-f9167003d947fa994cdd14406da79a1758acb7b3.tar.xz
Merge #8445: Move CWallet::setKeyPool to private section of CWallet.
8680d3a Move wallet initialization logic from AppInit2 to CWallet::InitLoadWallet (Patrick Strateman) e86eb71 Move CWallet::setKeyPool to private section of CWallet (Patrick Strateman)
Diffstat (limited to 'src/wallet')
-rw-r--r--src/wallet/wallet.cpp10
-rw-r--r--src/wallet/wallet.h15
-rw-r--r--src/wallet/walletdb.cpp10
3 files changed, 26 insertions, 9 deletions
diff --git a/src/wallet/wallet.cpp b/src/wallet/wallet.cpp
index 2d413fb9f9..769322969d 100644
--- a/src/wallet/wallet.cpp
+++ b/src/wallet/wallet.cpp
@@ -3416,7 +3416,17 @@ bool CWallet::InitLoadWallet()
}
walletInstance->SetBroadcastTransactions(GetBoolArg("-walletbroadcast", DEFAULT_WALLETBROADCAST));
+ {
+ LOCK(walletInstance->cs_wallet);
+ LogPrintf("setKeyPool.size() = %u\n", walletInstance->GetKeyPoolSize());
+ LogPrintf("mapWallet.size() = %u\n", walletInstance->mapWallet.size());
+ LogPrintf("mapAddressBook.size() = %u\n", walletInstance->mapAddressBook.size());
+ }
+ // Add wallet transactions that aren't already in a block to mapTransactions
+ walletInstance->ReacceptWalletTransactions();
+
pwalletMain = walletInstance;
+
return true;
}
diff --git a/src/wallet/wallet.h b/src/wallet/wallet.h
index 30f092e9a8..c06513650c 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 f824492cb6..e6e9fc484b 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")
{