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