@@ -193,7 +193,7 @@ CPubKey CWallet::GenerateNewKey(WalletBatch &batch, bool internal)
193
193
{
194
194
assert (!IsWalletFlagSet (WALLET_FLAG_DISABLE_PRIVATE_KEYS));
195
195
assert (!IsWalletFlagSet (WALLET_FLAG_BLANK_WALLET));
196
- AssertLockHeld (cs_wallet); // mapKeyMetadata
196
+ AssertLockHeld (cs_wallet);
197
197
bool fCompressed = CanSupportFeature (FEATURE_COMPRPUBKEY); // default to compressed public keys if we want 0.6.0 wallets
198
198
199
199
CKey secret;
@@ -281,9 +281,9 @@ void CWallet::DeriveNewChildKey(WalletBatch &batch, CKeyMetadata& metadata, CKey
281
281
throw std::runtime_error (std::string (__func__) + " : Writing HD chain model failed" );
282
282
}
283
283
284
- bool CWallet::AddKeyPubKeyWithDB (WalletBatch & batch, const CKey& secret, const CPubKey & pubkey)
284
+ bool CWallet::AddKeyPubKeyWithDB (WalletBatch& batch, const CKey& secret, const CPubKey& pubkey)
285
285
{
286
- AssertLockHeld (cs_wallet); // mapKeyMetadata
286
+ AssertLockHeld (cs_wallet);
287
287
288
288
// Make sure we aren't adding private keys to private key disabled wallets
289
289
assert (!IsWalletFlagSet (WALLET_FLAG_DISABLE_PRIVATE_KEYS));
@@ -345,16 +345,16 @@ bool CWallet::AddCryptedKey(const CPubKey &vchPubKey,
345
345
}
346
346
}
347
347
348
- void CWallet::LoadKeyMetadata (const CKeyID& keyID, const CKeyMetadata & meta)
348
+ void CWallet::LoadKeyMetadata (const CKeyID& keyID, const CKeyMetadata& meta)
349
349
{
350
- AssertLockHeld (cs_wallet); // mapKeyMetadata
350
+ AssertLockHeld (cs_wallet);
351
351
UpdateTimeFirstKey (meta.nCreateTime );
352
352
mapKeyMetadata[keyID] = meta;
353
353
}
354
354
355
- void CWallet::LoadScriptMetadata (const CScriptID& script_id, const CKeyMetadata & meta)
355
+ void CWallet::LoadScriptMetadata (const CScriptID& script_id, const CKeyMetadata& meta)
356
356
{
357
- AssertLockHeld (cs_wallet); // m_script_metadata
357
+ AssertLockHeld (cs_wallet);
358
358
UpdateTimeFirstKey (meta.nCreateTime );
359
359
m_script_metadata[script_id] = meta;
360
360
}
@@ -367,7 +367,7 @@ bool CWallet::WriteKeyMetadata(const CKeyMetadata& meta, const CPubKey& pubkey,
367
367
368
368
void CWallet::UpgradeKeyMetadata ()
369
369
{
370
- AssertLockHeld (cs_wallet); // mapKeyMetadata
370
+ AssertLockHeld (cs_wallet);
371
371
if (IsLocked () || IsWalletFlagSet (WALLET_FLAG_KEY_ORIGIN_METADATA)) {
372
372
return ;
373
373
}
@@ -569,7 +569,7 @@ void CWallet::ChainStateFlushed(const CBlockLocator& loc)
569
569
570
570
void CWallet::SetMinVersion (enum WalletFeature nVersion, WalletBatch* batch_in, bool fExplicit )
571
571
{
572
- LOCK (cs_wallet); // nWalletVersion
572
+ LOCK (cs_wallet);
573
573
if (nWalletVersion >= nVersion)
574
574
return ;
575
575
@@ -593,7 +593,7 @@ void CWallet::SetMinVersion(enum WalletFeature nVersion, WalletBatch* batch_in,
593
593
594
594
bool CWallet::SetMaxVersion (int nVersion)
595
595
{
596
- LOCK (cs_wallet); // nWalletVersion, nWalletMaxVersion
596
+ LOCK (cs_wallet);
597
597
// cannot downgrade below current version
598
598
if (nWalletVersion > nVersion)
599
599
return false ;
@@ -877,9 +877,9 @@ DBErrors CWallet::ReorderTransactions()
877
877
return DBErrors::LOAD_OK;
878
878
}
879
879
880
- int64_t CWallet::IncOrderPosNext (WalletBatch * batch)
880
+ int64_t CWallet::IncOrderPosNext (WalletBatch* batch)
881
881
{
882
- AssertLockHeld (cs_wallet); // nOrderPosNext
882
+ AssertLockHeld (cs_wallet);
883
883
int64_t nRet = nOrderPosNext++;
884
884
if (batch) {
885
885
batch->WriteOrderPosNext (nOrderPosNext);
@@ -2614,9 +2614,9 @@ bool CWallet::SelectCoins(const std::vector<COutput>& vAvailableCoins, const CAm
2614
2614
return res;
2615
2615
}
2616
2616
2617
- bool CWallet::SignTransaction (CMutableTransaction & tx)
2617
+ bool CWallet::SignTransaction (CMutableTransaction& tx)
2618
2618
{
2619
- AssertLockHeld (cs_wallet); // mapWallet
2619
+ AssertLockHeld (cs_wallet);
2620
2620
2621
2621
// sign the new tx
2622
2622
int nIn = 0 ;
@@ -3230,8 +3230,8 @@ DBErrors CWallet::LoadWallet(bool& fFirstRunRet)
3230
3230
3231
3231
DBErrors CWallet::ZapSelectTx (std::vector<uint256>& vHashIn, std::vector<uint256>& vHashOut)
3232
3232
{
3233
- AssertLockHeld (cs_wallet); // mapWallet
3234
- DBErrors nZapSelectTxRet = WalletBatch (*database," cr+" ).ZapSelectTx (vHashIn, vHashOut);
3233
+ AssertLockHeld (cs_wallet);
3234
+ DBErrors nZapSelectTxRet = WalletBatch (*database, " cr+" ).ZapSelectTx (vHashIn, vHashOut);
3235
3235
for (uint256 hash : vHashOut) {
3236
3236
const auto & it = mapWallet.find (hash);
3237
3237
wtxOrdered.erase (it->second .m_it_wtxOrdered );
@@ -3257,7 +3257,6 @@ DBErrors CWallet::ZapSelectTx(std::vector<uint256>& vHashIn, std::vector<uint256
3257
3257
MarkDirty ();
3258
3258
3259
3259
return DBErrors::LOAD_OK;
3260
-
3261
3260
}
3262
3261
3263
3262
DBErrors CWallet::ZapWalletTx (std::vector<CWalletTx>& vWtx)
@@ -3377,7 +3376,7 @@ bool CWallet::NewKeyPool()
3377
3376
3378
3377
size_t CWallet::KeypoolCountExternalKeys ()
3379
3378
{
3380
- AssertLockHeld (cs_wallet); // setExternalKeyPool
3379
+ AssertLockHeld (cs_wallet);
3381
3380
return setExternalKeyPool.size () + set_pre_split_keypool.size ();
3382
3381
}
3383
3382
@@ -3641,7 +3640,7 @@ std::map<CTxDestination, CAmount> CWallet::GetAddressBalances(interfaces::Chain:
3641
3640
3642
3641
std::set< std::set<CTxDestination> > CWallet::GetAddressGroupings ()
3643
3642
{
3644
- AssertLockHeld (cs_wallet); // mapWallet
3643
+ AssertLockHeld (cs_wallet);
3645
3644
std::set< std::set<CTxDestination> > groupings;
3646
3645
std::set<CTxDestination> grouping;
3647
3646
@@ -3809,33 +3808,33 @@ void CWallet::MarkReserveKeysAsUsed(int64_t keypool_id)
3809
3808
3810
3809
void CWallet::LockCoin (const COutPoint& output)
3811
3810
{
3812
- AssertLockHeld (cs_wallet); // setLockedCoins
3811
+ AssertLockHeld (cs_wallet);
3813
3812
setLockedCoins.insert (output);
3814
3813
}
3815
3814
3816
3815
void CWallet::UnlockCoin (const COutPoint& output)
3817
3816
{
3818
- AssertLockHeld (cs_wallet); // setLockedCoins
3817
+ AssertLockHeld (cs_wallet);
3819
3818
setLockedCoins.erase (output);
3820
3819
}
3821
3820
3822
3821
void CWallet::UnlockAllCoins ()
3823
3822
{
3824
- AssertLockHeld (cs_wallet); // setLockedCoins
3823
+ AssertLockHeld (cs_wallet);
3825
3824
setLockedCoins.clear ();
3826
3825
}
3827
3826
3828
3827
bool CWallet::IsLockedCoin (uint256 hash, unsigned int n) const
3829
3828
{
3830
- AssertLockHeld (cs_wallet); // setLockedCoins
3829
+ AssertLockHeld (cs_wallet);
3831
3830
COutPoint outpt (hash, n);
3832
3831
3833
3832
return (setLockedCoins.count (outpt) > 0 );
3834
3833
}
3835
3834
3836
3835
void CWallet::ListLockedCoins (std::vector<COutPoint>& vOutpts) const
3837
3836
{
3838
- AssertLockHeld (cs_wallet); // setLockedCoins
3837
+ AssertLockHeld (cs_wallet);
3839
3838
for (std::set<COutPoint>::iterator it = setLockedCoins.begin ();
3840
3839
it != setLockedCoins.end (); it++) {
3841
3840
COutPoint outpt = (*it);
@@ -3845,8 +3844,8 @@ void CWallet::ListLockedCoins(std::vector<COutPoint>& vOutpts) const
3845
3844
3846
3845
/* * @} */ // end of Actions
3847
3846
3848
- void CWallet::GetKeyBirthTimes (interfaces::Chain::Lock& locked_chain, std::map<CTxDestination, int64_t > & mapKeyBirth) const {
3849
- AssertLockHeld (cs_wallet); // mapKeyMetadata
3847
+ void CWallet::GetKeyBirthTimes (interfaces::Chain::Lock& locked_chain, std::map<CTxDestination, int64_t >& mapKeyBirth) const {
3848
+ AssertLockHeld (cs_wallet);
3850
3849
mapKeyBirth.clear ();
3851
3850
3852
3851
// get birth times for keys with metadata
@@ -4125,7 +4124,7 @@ std::shared_ptr<CWallet> CWallet::CreateWalletFromFile(interfaces::Chain& chain,
4125
4124
}
4126
4125
}
4127
4126
4128
- int prev_version = walletInstance->nWalletVersion ;
4127
+ int prev_version = walletInstance->GetVersion () ;
4129
4128
if (gArgs .GetBoolArg (" -upgradewallet" , fFirstRun ))
4130
4129
{
4131
4130
int nMaxVersion = gArgs .GetArg (" -upgradewallet" , 0 );
@@ -4150,8 +4149,8 @@ std::shared_ptr<CWallet> CWallet::CreateWalletFromFile(interfaces::Chain& chain,
4150
4149
LOCK (walletInstance->cs_wallet );
4151
4150
4152
4151
// Do not upgrade versions to any version between HD_SPLIT and FEATURE_PRE_SPLIT_KEYPOOL unless already supporting HD_SPLIT
4153
- int max_version = walletInstance->nWalletVersion ;
4154
- if (!walletInstance->CanSupportFeature (FEATURE_HD_SPLIT) && max_version >=FEATURE_HD_SPLIT && max_version < FEATURE_PRE_SPLIT_KEYPOOL) {
4152
+ int max_version = walletInstance->GetVersion () ;
4153
+ if (!walletInstance->CanSupportFeature (FEATURE_HD_SPLIT) && max_version >= FEATURE_HD_SPLIT && max_version < FEATURE_PRE_SPLIT_KEYPOOL) {
4155
4154
chain.initError (_ (" Cannot upgrade a non HD split wallet without upgrading to support pre split keypool. Please use -upgradewallet=169900 or -upgradewallet with no version specified." ));
4156
4155
return nullptr ;
4157
4156
}
0 commit comments