### Is there an existing issue for this?

- [X] I have searched the existing issues

### Current behaviour

crash

### Expected behaviour

no crash

### Steps to reproduce

* Compile 79e8247ddb166f9b980f40249b7372a502402a4d
* Type `migratewallet`

### Relevant log output

```
wallet/scriptpubkeyman.cpp:1915: std::optional<MigrationData> wallet::LegacyScriptPubKeyMan::MigrateToDescriptor(): Assertion `IsMine(desc_spk) != ISMINE_NO' failed.
Aborted (core dumped)
```


### How did you obtain Bitcoin Core

Compiled from source

### What version of Bitcoin Core are you using?

current master

### Operating system and version

Linux

### Machine specifications

_No response_
if (new_value.size() == setting_value.size()) return true;
    return chain.updateRwSetting("wal", new_val
}
static void UpdateWalSetting(interfacesChain& chain,
                                const stdstring& wal_name,
                                stdoptional<bool> load_on_startup,
                                stdvector<bilingual_str>& warnings)
{
    if (!load_on_startup) return;
    if (load_on_startup.value() && !AddWalSetting(chain, wal_name)) {
        warnings.emplace_back(Untranslated("Wal load on startup setting could not be updated, so wal may not be loaded next node startup."));
    } else if (!load_on_startup.value() && !RemoveWalSetting(chain, wal_name)) {
        warnings.emplace_back(Untranslated("Wal load on startup setting could not be updated, so wal may still be loaded next node startup."));
    }
}
/**
 * Refresh mempool status so th is in an internally consistent state and
 * immediately knows the transaction's status Whether it can be considered
 * trusted and is eligible to be abandoned ...
 */
static void RefreshMempoolStatus(CWalTx& tx, interfacesChain& chain)
{
    if (chain.isInMempool(tx.GetHash())) {
        tx.m_state = TxStateInMempool();
    } else if (tx.state<TxStateInMempool>()) {
        tx.m_state = TxStateInactive();
    }
}
bool AddWal(WalContext& context, const stdshared_ptr<CWal>& wal)
{