Built against `master` branch 801dd40666d1e6009920ad3ff755c7bb993b2a62:

If I have no wallet.dat file and run:

    bitcoind -usehd=0

A new wallet.dat file is created and an HD seed is assigned.

I see an error message in the source:

    "Error loading %s: You can't disable HD on an already existing HD wallet or create new non-HD wallets."

but that doesn't get shown because `fFirstRun` is true, and so the code which checks for `-usehd` values doesn't run.

If it's no longer possible to create non-HD wallets, specifying -usehd=0 when creating a wallet should be an error, and not get silently ignored.
{
    if (nIndex != -1) {
        pwallet->ReturnKey(nIndex, fInternal, vchPubKey);
    }
    nIndex = -1;
    vchPubKey = CPubKey();
}
void CWallet::MarkReserveKeysAsUsed(int64_t keypool_id)
{
    AssertLockHeld(cs_wallet);
    bool internal = setInternalKeyPool.count(keypool_id);
    if (!internal) assert(setExternalKeyPool.count(keypool_id));
    std::set<int64_t> *setKeyPool = internal ? &setInternalKeyPool : &setExternalKeyPool;
    auto it = setKeyPool->begin();
    CWalletDB walletdb(*dbw);
    while (it != std::end(*setKeyPool)) {
        const int64_t& index = *(it);
        if (index > keypool_id) break; 
        CKeyPool keypool;
        if (walletdb.ReadPool(index, keypool)) { 
            m_pool_key_to_index.erase(keypool.vchPubKey.GetID());
        }
        walletdb.ErasePool(index);
        LogPrintf("keypool index %d removed\n", index);
        it = setKeyPool->erase(it);
    }
}
void CWallet::GetScriptForMining(std::shared_ptr<CReserveScript> &script)