@@ -661,22 +661,22 @@ class CWallet final : public CCryptoKeyStore, public CValidationInterface
661
661
{
662
662
private:
663
663
static std::atomic<bool > fFlushScheduled ;
664
- std::atomic<bool > fAbortRescan ;
665
- std::atomic<bool > fScanningWallet ; // controlled by WalletRescanReserver
664
+ std::atomic<bool > fAbortRescan { false } ;
665
+ std::atomic<bool > fScanningWallet { false } ; // controlled by WalletRescanReserver
666
666
std::mutex mutexScanning;
667
667
friend class WalletRescanReserver ;
668
668
669
- CWalletDB *pwalletdbEncryption;
669
+ CWalletDB *pwalletdbEncryption = nullptr ;
670
670
671
671
// ! the current wallet version: clients below this version are not able to load the wallet
672
- int nWalletVersion;
672
+ int nWalletVersion = FEATURE_BASE ;
673
673
674
674
// ! the maximum wallet format version: memory-only variable that specifies to what version this wallet may be upgraded
675
- int nWalletMaxVersion;
675
+ int nWalletMaxVersion = FEATURE_BASE ;
676
676
677
- int64_t nNextResend;
678
- int64_t nLastResend;
679
- bool fBroadcastTransactions ;
677
+ int64_t nNextResend = 0 ;
678
+ int64_t nLastResend = 0 ;
679
+ bool fBroadcastTransactions = false ;
680
680
681
681
/* *
682
682
* Used to keep track of spent outpoints, and
@@ -705,10 +705,10 @@ class CWallet final : public CCryptoKeyStore, public CValidationInterface
705
705
706
706
std::set<int64_t > setInternalKeyPool;
707
707
std::set<int64_t > setExternalKeyPool;
708
- int64_t m_max_keypool_index;
708
+ int64_t m_max_keypool_index = 0 ;
709
709
std::map<CKeyID, int64_t > m_pool_key_to_index;
710
710
711
- int64_t nTimeFirstKey;
711
+ int64_t nTimeFirstKey = 0 ;
712
712
713
713
/* *
714
714
* Private version of AddWatchOnly method which does not accept a
@@ -741,7 +741,7 @@ class CWallet final : public CCryptoKeyStore, public CValidationInterface
741
741
*
742
742
* Protected by cs_main (see BlockUntilSyncedToCurrentChain)
743
743
*/
744
- const CBlockIndex* m_last_block_processed;
744
+ const CBlockIndex* m_last_block_processed = nullptr ;
745
745
746
746
public:
747
747
/*
@@ -780,12 +780,11 @@ class CWallet final : public CCryptoKeyStore, public CValidationInterface
780
780
781
781
typedef std::map<unsigned int , CMasterKey> MasterKeyMap;
782
782
MasterKeyMap mapMasterKeys;
783
- unsigned int nMasterKeyMaxID;
783
+ unsigned int nMasterKeyMaxID = 0 ;
784
784
785
785
/* * Construct wallet with specified name and database implementation. */
786
786
CWallet (std::string name, std::unique_ptr<CWalletDBWrapper> dbw) : m_name(std::move(name)), dbw(std::move(dbw))
787
787
{
788
- SetNull ();
789
788
}
790
789
791
790
~CWallet ()
@@ -794,33 +793,15 @@ class CWallet final : public CCryptoKeyStore, public CValidationInterface
794
793
pwalletdbEncryption = nullptr ;
795
794
}
796
795
797
- void SetNull ()
798
- {
799
- nWalletVersion = FEATURE_BASE;
800
- nWalletMaxVersion = FEATURE_BASE;
801
- nMasterKeyMaxID = 0 ;
802
- pwalletdbEncryption = nullptr ;
803
- nOrderPosNext = 0 ;
804
- nAccountingEntryNumber = 0 ;
805
- nNextResend = 0 ;
806
- nLastResend = 0 ;
807
- m_max_keypool_index = 0 ;
808
- nTimeFirstKey = 0 ;
809
- fBroadcastTransactions = false ;
810
- nRelockTime = 0 ;
811
- fAbortRescan = false ;
812
- fScanningWallet = false ;
813
- }
814
-
815
796
std::map<uint256, CWalletTx> mapWallet;
816
797
std::list<CAccountingEntry> laccentries;
817
798
818
799
typedef std::pair<CWalletTx*, CAccountingEntry*> TxPair;
819
800
typedef std::multimap<int64_t , TxPair > TxItems;
820
801
TxItems wtxOrdered;
821
802
822
- int64_t nOrderPosNext;
823
- uint64_t nAccountingEntryNumber;
803
+ int64_t nOrderPosNext = 0 ;
804
+ uint64_t nAccountingEntryNumber = 0 ;
824
805
std::map<uint256, int > mapRequestCount;
825
806
826
807
std::map<CTxDestination, CAddressBookData> mapAddressBook;
@@ -913,7 +894,7 @@ class CWallet final : public CCryptoKeyStore, public CValidationInterface
913
894
bool LoadWatchOnly (const CScript &dest);
914
895
915
896
// ! Holds a timestamp at which point the wallet is scheduled (externally) to be relocked. Caller must arrange for actual relocking to occur via Lock().
916
- int64_t nRelockTime;
897
+ int64_t nRelockTime = 0 ;
917
898
918
899
bool Unlock (const SecureString& strWalletPassphrase);
919
900
bool ChangeWalletPassphrase (const SecureString& strOldWalletPassphrase, const SecureString& strNewWalletPassphrase);
0 commit comments