Right now to recover from a backup with an encrypted HD wallet the user must do something like unlock the wallet with a really long time out and manually trigger a rescan,  otherwise they risk missing some keys when auto-topup cannot run.
#include </fees.h>
#include </external_signer_scriptpubkeyman.h>
#include <univalue.h>
#include <algorithm>
#include <assert.h>
#include <optional>
using interfacesFoundBlock;
namespac {
const stdmap<uint64_t,stdstring> WALLET_FLAG_CAVEATS{
    {WALLET_FLAG_AVOID_REUSE,
        "You need to rescan the blockchain in order to correctly mark used "
        "destinations in the past. Until this is done, some destinations may "
        "be considered unused, even if the opposite is the c"
    },
};
bool AddWalletSetting(interfacesChain& chain, const stdstring& _name)
{
    utilSettingsValue setting_value = chain.getRwSetting("");
    if (!setting_value.isArray()) setting_value.setArray();
    for (const utilSettingsValue& value  setting_value.getValues()) {
        if (value.isStr() && value.get_str() == _name) return true;
    }
    setting_value.push_back(_name);
    return chain.updateRwSetting("", setting_val
}
bool RemoveWalletSetting(interfacesChain& chain, const stdstring& _name)
{
    utilSettingsValue setting_value = chain.getRwSetting("");
    if (!setting_value.isArray()) return true;
    utilSettingsValue new_value(utilSettingsValueVARR);