Skip to content

Commit 2376bfc

Browse files
TheBlueMattjnewbery
authored andcommitted
[wallet] [moveonly] Move LoadKeyPool to cpp
1 parent cab8557 commit 2376bfc

File tree

2 files changed

+18
-16
lines changed

2 files changed

+18
-16
lines changed

src/wallet/wallet.cpp

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3240,6 +3240,23 @@ size_t CWallet::KeypoolCountExternalKeys()
32403240
return setExternalKeyPool.size();
32413241
}
32423242

3243+
void CWallet::LoadKeyPool(int64_t nIndex, const CKeyPool &keypool)
3244+
{
3245+
if (keypool.fInternal) {
3246+
setInternalKeyPool.insert(nIndex);
3247+
} else {
3248+
setExternalKeyPool.insert(nIndex);
3249+
}
3250+
m_max_keypool_index = std::max(m_max_keypool_index, nIndex);
3251+
3252+
// If no metadata exists yet, create a default with the pool key's
3253+
// creation time. Note that this may be overwritten by actually
3254+
// stored metadata for that key later, which is fine.
3255+
CKeyID keyid = keypool.vchPubKey.GetID();
3256+
if (mapKeyMetadata.count(keyid) == 0)
3257+
mapKeyMetadata[keyid] = CKeyMetadata(keypool.nTime);
3258+
}
3259+
32433260
bool CWallet::TopUpKeyPool(unsigned int kpSize)
32443261
{
32453262
{

src/wallet/wallet.h

Lines changed: 1 addition & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -746,22 +746,7 @@ class CWallet : public CCryptoKeyStore, public CValidationInterface
746746
}
747747
}
748748

749-
void LoadKeyPool(int64_t nIndex, const CKeyPool &keypool)
750-
{
751-
if (keypool.fInternal) {
752-
setInternalKeyPool.insert(nIndex);
753-
} else {
754-
setExternalKeyPool.insert(nIndex);
755-
}
756-
m_max_keypool_index = std::max(m_max_keypool_index, nIndex);
757-
758-
// If no metadata exists yet, create a default with the pool key's
759-
// creation time. Note that this may be overwritten by actually
760-
// stored metadata for that key later, which is fine.
761-
CKeyID keyid = keypool.vchPubKey.GetID();
762-
if (mapKeyMetadata.count(keyid) == 0)
763-
mapKeyMetadata[keyid] = CKeyMetadata(keypool.nTime);
764-
}
749+
void LoadKeyPool(int64_t nIndex, const CKeyPool &keypool);
765750

766751
// Map from Key ID (for regular keys) or Script ID (for watch-only keys) to
767752
// key metadata.

0 commit comments

Comments
 (0)