Skip to content

Commit ae70e8a

Browse files
authored
Fix negative "keys left since backup" (#2671)
1 parent 2a330f1 commit ae70e8a

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/wallet/wallet.cpp

+4-2
Original file line numberDiff line numberDiff line change
@@ -4262,8 +4262,10 @@ void CWallet::KeepKey(int64_t nIndex)
42624262
if (fFileBacked)
42634263
{
42644264
CWalletDB walletdb(strWalletFile);
4265-
walletdb.ErasePool(nIndex);
4266-
nKeysLeftSinceAutoBackup = nWalletBackups ? nKeysLeftSinceAutoBackup - 1 : 0;
4265+
if (walletdb.ErasePool(nIndex))
4266+
--nKeysLeftSinceAutoBackup;
4267+
if (!nWalletBackups)
4268+
nKeysLeftSinceAutoBackup = 0;
42674269
}
42684270
LogPrintf("keypool keep %d\n", nIndex);
42694271
}

0 commit comments

Comments
 (0)