mirror of
https://github.com/Retropex/bitcoin.git
synced 2025-06-02 15:32:34 +02:00
Refactor: Move GetKeypoolSize code out of CWallet
This commit does not change behavior.
This commit is contained in:
parent
089e17d45c
commit
7ef47b88e6
@ -464,6 +464,12 @@ size_t LegacyScriptPubKeyMan::KeypoolCountExternalKeys()
|
|||||||
return setExternalKeyPool.size() + set_pre_split_keypool.size();
|
return setExternalKeyPool.size() + set_pre_split_keypool.size();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
unsigned int LegacyScriptPubKeyMan::GetKeyPoolSize() const
|
||||||
|
{
|
||||||
|
AssertLockHeld(cs_wallet);
|
||||||
|
return setInternalKeyPool.size() + setExternalKeyPool.size();
|
||||||
|
}
|
||||||
|
|
||||||
const CKeyMetadata* LegacyScriptPubKeyMan::GetMetadata(uint160 id) const
|
const CKeyMetadata* LegacyScriptPubKeyMan::GetMetadata(uint160 id) const
|
||||||
{
|
{
|
||||||
AssertLockHeld(cs_wallet);
|
AssertLockHeld(cs_wallet);
|
||||||
|
@ -182,6 +182,7 @@ public:
|
|||||||
virtual int64_t GetOldestKeyPoolTime() { return GetTime(); }
|
virtual int64_t GetOldestKeyPoolTime() { return GetTime(); }
|
||||||
|
|
||||||
virtual size_t KeypoolCountExternalKeys() { return 0; }
|
virtual size_t KeypoolCountExternalKeys() { return 0; }
|
||||||
|
virtual unsigned int GetKeyPoolSize() const { return 0; }
|
||||||
|
|
||||||
virtual const CKeyMetadata* GetMetadata(uint160 id) const { return nullptr; }
|
virtual const CKeyMetadata* GetMetadata(uint160 id) const { return nullptr; }
|
||||||
};
|
};
|
||||||
@ -295,6 +296,7 @@ public:
|
|||||||
|
|
||||||
int64_t GetOldestKeyPoolTime() override;
|
int64_t GetOldestKeyPoolTime() override;
|
||||||
size_t KeypoolCountExternalKeys() override EXCLUSIVE_LOCKS_REQUIRED(cs_wallet);
|
size_t KeypoolCountExternalKeys() override EXCLUSIVE_LOCKS_REQUIRED(cs_wallet);
|
||||||
|
unsigned int GetKeyPoolSize() const override;
|
||||||
|
|
||||||
const CKeyMetadata* GetMetadata(uint160 id) const override;
|
const CKeyMetadata* GetMetadata(uint160 id) const override;
|
||||||
|
|
||||||
|
@ -3027,6 +3027,17 @@ size_t CWallet::KeypoolCountExternalKeys()
|
|||||||
return count;
|
return count;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
unsigned int CWallet::GetKeyPoolSize() const
|
||||||
|
{
|
||||||
|
AssertLockHeld(cs_wallet);
|
||||||
|
|
||||||
|
unsigned int count = 0;
|
||||||
|
if (auto spk_man = m_spk_man.get()) {
|
||||||
|
count += spk_man->GetKeyPoolSize();
|
||||||
|
}
|
||||||
|
return count;
|
||||||
|
}
|
||||||
|
|
||||||
bool CWallet::TopUpKeyPool(unsigned int kpSize)
|
bool CWallet::TopUpKeyPool(unsigned int kpSize)
|
||||||
{
|
{
|
||||||
bool res = true;
|
bool res = true;
|
||||||
|
@ -992,11 +992,7 @@ public:
|
|||||||
|
|
||||||
bool DelAddressBook(const CTxDestination& address);
|
bool DelAddressBook(const CTxDestination& address);
|
||||||
|
|
||||||
unsigned int GetKeyPoolSize() EXCLUSIVE_LOCKS_REQUIRED(cs_wallet)
|
unsigned int GetKeyPoolSize() const EXCLUSIVE_LOCKS_REQUIRED(cs_wallet);
|
||||||
{
|
|
||||||
AssertLockHeld(cs_wallet);
|
|
||||||
return setInternalKeyPool.size() + setExternalKeyPool.size();
|
|
||||||
}
|
|
||||||
|
|
||||||
//! signify that a particular wallet feature is now used. this may change nWalletVersion and nWalletMaxVersion if those are lower
|
//! signify that a particular wallet feature is now used. this may change nWalletVersion and nWalletMaxVersion if those are lower
|
||||||
void SetMinVersion(enum WalletFeature, WalletBatch* batch_in = nullptr, bool fExplicit = false) override;
|
void SetMinVersion(enum WalletFeature, WalletBatch* batch_in = nullptr, bool fExplicit = false) override;
|
||||||
@ -1131,8 +1127,6 @@ public:
|
|||||||
LegacyScriptPubKeyMan::WatchOnlySet& setWatchOnly GUARDED_BY(cs_KeyStore) = m_spk_man->setWatchOnly;
|
LegacyScriptPubKeyMan::WatchOnlySet& setWatchOnly GUARDED_BY(cs_KeyStore) = m_spk_man->setWatchOnly;
|
||||||
LegacyScriptPubKeyMan::WatchKeyMap& mapWatchKeys GUARDED_BY(cs_KeyStore) = m_spk_man->mapWatchKeys;
|
LegacyScriptPubKeyMan::WatchKeyMap& mapWatchKeys GUARDED_BY(cs_KeyStore) = m_spk_man->mapWatchKeys;
|
||||||
WalletBatch*& encrypted_batch GUARDED_BY(cs_wallet) = m_spk_man->encrypted_batch;
|
WalletBatch*& encrypted_batch GUARDED_BY(cs_wallet) = m_spk_man->encrypted_batch;
|
||||||
std::set<int64_t>& setInternalKeyPool GUARDED_BY(cs_wallet) = m_spk_man->setInternalKeyPool;
|
|
||||||
std::set<int64_t>& setExternalKeyPool GUARDED_BY(cs_wallet) = m_spk_man->setExternalKeyPool;
|
|
||||||
int64_t& nTimeFirstKey GUARDED_BY(cs_wallet) = m_spk_man->nTimeFirstKey;
|
int64_t& nTimeFirstKey GUARDED_BY(cs_wallet) = m_spk_man->nTimeFirstKey;
|
||||||
using CryptedKeyMap = LegacyScriptPubKeyMan::CryptedKeyMap;
|
using CryptedKeyMap = LegacyScriptPubKeyMan::CryptedKeyMap;
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user