src/wallet/wallet.cpp
bool CWallet::NewKeyPool()
{
    {
        LOCK(cs_wallet);
        CWalletDB walletdb(*dbw);

        for (const int64_t nIndex : setInternalKeyPool) {
            walletdb.ErasePool(nIndex);
        }
        setInternalKeyPool.clear();

        for (const int64_t nIndex : setExternalKeyPool) {
            walletdb.ErasePool(nIndex);
        }
        setExternalKeyPool.clear();

        m_pool_key_to_index.clear();

        for (int64_t nIndex : set_pre_split_keypool) {
            walletdb.ErasePool(nIndex);
        }
        set_pre_split_keypool.clear();

        if (!TopUpKeyPool()) {
            return false;
        }
        LogPrintf("CWallet::NewKeyPool rewrote keypool\n");
    }
    return true;
}
/**
 * Mark old keypool keys as used,
 * and generate all new keys
 */
Mark old keypool keys as used,
and generate all new keys
Mark old keypool keys as used and generate all new keys
bool CWallet::NewKeyPool()
{
    {
        LOCK(cs_wallet);
        CWalletDB walletdb(*dbw);
        for (const int64_t nIndex : setInternalKeyPool) {
            walletdb.ErasePool(nIndex);
        }
        setInternalKeyPool.clear();
        for (const int64_t nIndex : setExternalKeyPool) {
            walletdb.ErasePool(nIndex);
        }
        setExternalKeyPool.clear();
        m_pool_key_to_index.clear();
        for (int64_t nIndex : set_pre_split_keypool) {
            walletdb.ErasePool(nIndex);
        }
        set_pre_split_keypool.clear();
        if (!TopUpKeyPool()) {
            return false;
        }
        LogPrintf("CWallet::NewKeyPool rewrote keypool\n");
    }
    return true;
}
bool CWallet :: NewKeyPool ( ) { { LOCK ( cs_wallet ) ; CWalletDB walletdb ( * dbw ) ; for ( const int64_t nIndex : setInternalKeyPool ) { walletdb . ErasePool ( nIndex ) ; } setInternalKeyPool . clear ( ) ; for ( const int64_t nIndex : setExternalKeyPool ) { walletdb . ErasePool ( nIndex ) ; } setExternalKeyPool . clear ( ) ; m_pool_key_to_index . clear ( ) ; for ( int64_t nIndex : set_pre_split_keypool ) { walletdb . ErasePool ( nIndex ) ; } set_pre_split_keypool . clear ( ) ; if ( ! TopUpKeyPool ( ) ) { return false ; } LogPrintf ( " \n " ) ; } return true ; }
Mark old keypool keys as used,
 and generate all new keys
Mark old keypool keys as used and generate all new keys