Fix negative "keys left since backup" (#2671)

This commit is contained in:
UdjinM6 2019-02-01 12:07:03 +03:00 committed by GitHub
parent 2a330f17ac
commit ae70e8a344
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -4262,8 +4262,10 @@ void CWallet::KeepKey(int64_t nIndex)
if (fFileBacked) if (fFileBacked)
{ {
CWalletDB walletdb(strWalletFile); CWalletDB walletdb(strWalletFile);
walletdb.ErasePool(nIndex); if (walletdb.ErasePool(nIndex))
nKeysLeftSinceAutoBackup = nWalletBackups ? nKeysLeftSinceAutoBackup - 1 : 0; --nKeysLeftSinceAutoBackup;
if (!nWalletBackups)
nKeysLeftSinceAutoBackup = 0;
} }
LogPrintf("keypool keep %d\n", nIndex); LogPrintf("keypool keep %d\n", nIndex);
} }