Make sure we always generate one keypool key at minimum
This commit is contained in:
parent
d0a627a53a
commit
bcafca1077
1 changed files with 3 additions and 3 deletions
|
@ -2950,9 +2950,9 @@ bool CWallet::TopUpKeyPool(unsigned int kpSize)
|
||||||
// generate +20% internal keys (minimum 2 keys)
|
// generate +20% internal keys (minimum 2 keys)
|
||||||
int64_t amountExternal = KeypoolCountExternalKeys();
|
int64_t amountExternal = KeypoolCountExternalKeys();
|
||||||
int64_t amountInternal = setKeyPool.size() - amountExternal;
|
int64_t amountInternal = setKeyPool.size() - amountExternal;
|
||||||
int64_t targetInternal = max((int64_t)ceil(nTargetSize * 0.2), (int64_t) 2);
|
int64_t targetInternal = std::max((int64_t)ceil(nTargetSize * 0.2), (int64_t) 2);
|
||||||
int64_t missingExternal = max( (int64_t)(nTargetSize - amountExternal), (int64_t) 0);
|
int64_t missingExternal = std::max(std::max((int64_t) nTargetSize, (int64_t) 1) - amountExternal, (int64_t) 0);
|
||||||
int64_t missingInternal = max(targetInternal - amountInternal, (int64_t) 0);
|
int64_t missingInternal = std::max(targetInternal - amountInternal, (int64_t) 0);
|
||||||
|
|
||||||
if (!IsHDEnabled() || !CanSupportFeature(FEATURE_HD_SPLIT))
|
if (!IsHDEnabled() || !CanSupportFeature(FEATURE_HD_SPLIT))
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue