Merge #12785: wallet: Initialize m_last_block_processed to nullptr

f63bc5e wallet: Initialize m_last_block_processed to nullptr. Initialize fields where defined. (practicalswift)

Pull request description:

  Initialize `m_last_block_processed` to `nullptr`.

  `m_last_block_processed` was introduced in 5ee3172636.

Tree-SHA512: 6e4a807e5b02115cbd80460761056f2eb22043203212d88dd0cd44c28dc0abce30ab29b078ca2c612232e76af4886f4fdbf2b0ff75e2df19b4d1a801b236cc13
This commit is contained in:
Wladimir J. van der Laan 2018-04-07 16:39:56 +02:00
commit 215158a633
No known key found for this signature in database
GPG key ID: 1E4AED62986CD25D

View file

@ -661,22 +661,22 @@ class CWallet final : public CCryptoKeyStore, public CValidationInterface
{
private:
static std::atomic<bool> fFlushScheduled;
std::atomic<bool> fAbortRescan;
std::atomic<bool> fScanningWallet; //controlled by WalletRescanReserver
std::atomic<bool> fAbortRescan{false};
std::atomic<bool> fScanningWallet{false}; // controlled by WalletRescanReserver
std::mutex mutexScanning;
friend class WalletRescanReserver;
CWalletDB *pwalletdbEncryption;
CWalletDB *pwalletdbEncryption = nullptr;
//! the current wallet version: clients below this version are not able to load the wallet
int nWalletVersion;
int nWalletVersion = FEATURE_BASE;
//! the maximum wallet format version: memory-only variable that specifies to what version this wallet may be upgraded
int nWalletMaxVersion;
int nWalletMaxVersion = FEATURE_BASE;
int64_t nNextResend;
int64_t nLastResend;
bool fBroadcastTransactions;
int64_t nNextResend = 0;
int64_t nLastResend = 0;
bool fBroadcastTransactions = false;
/**
* Used to keep track of spent outpoints, and
@ -705,10 +705,10 @@ private:
std::set<int64_t> setInternalKeyPool;
std::set<int64_t> setExternalKeyPool;
int64_t m_max_keypool_index;
int64_t m_max_keypool_index = 0;
std::map<CKeyID, int64_t> m_pool_key_to_index;
int64_t nTimeFirstKey;
int64_t nTimeFirstKey = 0;
/**
* Private version of AddWatchOnly method which does not accept a
@ -741,7 +741,7 @@ private:
*
* Protected by cs_main (see BlockUntilSyncedToCurrentChain)
*/
const CBlockIndex* m_last_block_processed;
const CBlockIndex* m_last_block_processed = nullptr;
public:
/*
@ -780,12 +780,11 @@ public:
typedef std::map<unsigned int, CMasterKey> MasterKeyMap;
MasterKeyMap mapMasterKeys;
unsigned int nMasterKeyMaxID;
unsigned int nMasterKeyMaxID = 0;
/** Construct wallet with specified name and database implementation. */
CWallet(std::string name, std::unique_ptr<CWalletDBWrapper> dbw) : m_name(std::move(name)), dbw(std::move(dbw))
{
SetNull();
}
~CWallet()
@ -794,24 +793,6 @@ public:
pwalletdbEncryption = nullptr;
}
void SetNull()
{
nWalletVersion = FEATURE_BASE;
nWalletMaxVersion = FEATURE_BASE;
nMasterKeyMaxID = 0;
pwalletdbEncryption = nullptr;
nOrderPosNext = 0;
nAccountingEntryNumber = 0;
nNextResend = 0;
nLastResend = 0;
m_max_keypool_index = 0;
nTimeFirstKey = 0;
fBroadcastTransactions = false;
nRelockTime = 0;
fAbortRescan = false;
fScanningWallet = false;
}
std::map<uint256, CWalletTx> mapWallet;
std::list<CAccountingEntry> laccentries;
@ -819,8 +800,8 @@ public:
typedef std::multimap<int64_t, TxPair > TxItems;
TxItems wtxOrdered;
int64_t nOrderPosNext;
uint64_t nAccountingEntryNumber;
int64_t nOrderPosNext = 0;
uint64_t nAccountingEntryNumber = 0;
std::map<uint256, int> mapRequestCount;
std::map<CTxDestination, CAddressBookData> mapAddressBook;
@ -913,7 +894,7 @@ public:
bool LoadWatchOnly(const CScript &dest);
//! Holds a timestamp at which point the wallet is scheduled (externally) to be relocked. Caller must arrange for actual relocking to occur via Lock().
int64_t nRelockTime;
int64_t nRelockTime = 0;
bool Unlock(const SecureString& strWalletPassphrase);
bool ChangeWalletPassphrase(const SecureString& strOldWalletPassphrase, const SecureString& strNewWalletPassphrase);