Browse Source

Merge #11044: [wallet] Keypool topup cleanups

67ceff4 [wallet] Add logging to MarkReserveKeysAsUsed (John Newbery)
1221f60 [wallet] Remove keypool_topup_cleanups (John Newbery)

Pull request description:

  A couple of minor cleanups suggested by @ryanofsky here: https://github.com/bitcoin/bitcoin/pull/11022#pullrequestreview-55598940

  Does not affect functionality. Not required for v0.15.

Tree-SHA512: d8d0698fd26ea49a4157e68669d5511095760c3a1ecfa3f917e3f273efbafb55c51a202d677614216eae3f796b6e8d17506b2ec2d4799a94f18981b396e65eec
0.16
Wladimir J. van der Laan 7 years ago
parent
commit
0e5b7486cb
No known key found for this signature in database
GPG Key ID: 1E4AED62986CD25D
  1. 6
      src/wallet/wallet.cpp
  2. 2
      src/wallet/wallet.h

6
src/wallet/wallet.cpp

@ -3668,15 +3668,11 @@ void CWallet::MarkReserveKeysAsUsed(int64_t keypool_id)
m_pool_key_to_index.erase(keypool.vchPubKey.GetID()); m_pool_key_to_index.erase(keypool.vchPubKey.GetID());
} }
walletdb.ErasePool(index); walletdb.ErasePool(index);
LogPrintf("keypool index %d removed\n", index);
it = setKeyPool->erase(it); it = setKeyPool->erase(it);
} }
} }
bool CWallet::HasUnusedKeys(int min_keys) const
{
return setExternalKeyPool.size() >= min_keys && (setInternalKeyPool.size() >= min_keys || !CanSupportFeature(FEATURE_HD_SPLIT));
}
void CWallet::GetScriptForMining(std::shared_ptr<CReserveScript> &script) void CWallet::GetScriptForMining(std::shared_ptr<CReserveScript> &script)
{ {
std::shared_ptr<CReserveKey> rKey = std::make_shared<CReserveKey>(this); std::shared_ptr<CReserveKey> rKey = std::make_shared<CReserveKey>(this);

2
src/wallet/wallet.h

@ -984,8 +984,6 @@ public:
*/ */
void MarkReserveKeysAsUsed(int64_t keypool_id); void MarkReserveKeysAsUsed(int64_t keypool_id);
const std::map<CKeyID, int64_t>& GetAllReserveKeys() const { return m_pool_key_to_index; } const std::map<CKeyID, int64_t>& GetAllReserveKeys() const { return m_pool_key_to_index; }
/** Does the wallet have at least min_keys in the keypool? */
bool HasUnusedKeys(int min_keys) const;
std::set< std::set<CTxDestination> > GetAddressGroupings(); std::set< std::set<CTxDestination> > GetAddressGroupings();
std::map<CTxDestination, CAmount> GetAddressBalances(); std::map<CTxDestination, CAmount> GetAddressBalances();

Loading…
Cancel
Save