Hi,

I run a bitcoin server which have acting strange the latest 3-4 days. For some reason the unconfirmed balance when running bitcoin-cli getunconfirmedbalance shows up as 50.589243 BTC which of course isn't true.

How do I reset this? Why did this occur? Tried both v0.12 and v0.12.99, same problem.

Thanks in advance,
Nori

{
    nIndex = -1;
    keypool.vchPubKey = CPubKey();
    {
        LOCK(cs_wallet);
        if (!IsLocked())
            TopUpKeyPool();
        
        if(setKeyPool.empty())
            return;
        CWalletDB walletdb(strWalletFile);
        nIndex = *(setKeyPool.begin());
        setKeyPool.erase(setKeyPool.begin());
        if (!walletdb.ReadPool(nIndex, keypool))
            throw runtime_error("ReserveKeyFromKeyPool(): read failed");
        if (!HaveKey(keypool.vchPubKey.GetID()))
            throw runtime_error("ReserveKeyFromKeyPool(): unknown key in key pool");
        assert(keypool.vchPubKey.IsValid());
        LogPrintf("keypool reserve %d\n", nIndex);
    }
}
void CWallet::KeepKey(int64_t nIndex)