### 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 (!batch.EraseAddressReceiveRequest(dest, id)) return false;
    m_address_book[dest].receive_requests.erase(id);
    return true;
}
stdunique_ptr<WalDatabase> MakeWalDatabase(const stdstring& name, const DatabaseOptions& options, DatabaseStatus& status, bilingual_str& error_string)
{
    // Do some checking on wal path. It should be either a
    //
    //  Path where a directory can be created.
    // 2. Path to an existing directory.
    // 3. Path to a symlink to a directory.
    // 4. For backwards compatibility, the name of a data file in -waldir.
    const fspath wal_path = fsbridgeAbsPathJoin(GetWalDir(), fsPathFromString(name));
    fsfile_type path_type = fssymlink_status(wal_path).type();
    if (!(path_type == fsfile_typenot_found || path_type == fsfile_typedirectory ||
          (path_type == fsfile_typesymlink && fsis_directory(wal_path)) ||
          (path_type == fsfile_typeregular && fsPathFromString(name).filename() == fsPathFromString(name)))) {
        error_string = Untranslated(strprintf(
              "Invalid -wal path '%s'. -wal path should point to a directory wher.dat and "
              "database/log.?????????? files can be stored, a location where such a directory could be created, "
              "or (for backwards compatibility) the name of an existing data file in -waldir (%s)",
              name, fsquoted(fsPathToString(GetWalDir()))));
        status = DatabaseStatusFAILED_BAD_PATH;
        return nullptr;
    }
    return MakeDatabase(wal_path, options, status, error_string);
}
stdshared_ptr<CWal> CWalCreate(WalContext& context, const stdstring& name, stdunique_ptr<WalDatabase> database, uint64_t wal_creation_flags, bilingual_str& error, stdvector<bilingual_str>& warnings)
{
    interfacesChain* chain = context.chain;