### 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_
util::Result<CTxDestination> GetNewDestination(const OutputType type) override;
    isminetype IsMine(const CScript& script) const override;
    bool CheckDecryptionKey(const CKeyingMaterial& master_key, bool accept_no_keys = false) override;
    bool Encrypt(const CKeyingMaterial& master_key, WalletBatch* batch) override;
    util::Result<CTxDestination> GetReservedDestination(const OutputType type, bool internal, int64_t& index, CKeyPool& keypool) override;
    void KeepDestination(int64_t index, const OutputType& type) override;
    void ReturnDestination(int64_t index, bool internal, const CTxDestination&) override;
    bool TopUp(unsigned int size = 0) override;
    std::vector<WalletDestination> MarkUnusedAddresses(const CScript& script) override;
    
    void UpgradeKeyMetadata();
    bool IsHDEnabled() const override;
    bool SetupGeneration(bool force = false) override;
    bool Upgrade(int prev_version, int new_version, bilingual_str& error) override;
    bool HavePrivateKeys() const override;
    void RewriteDB() override;
    std::optional<int64_t> GetOldestKeyPoolTime() const override;
    size_t KeypoolCountExternalKeys() const;
    unsigned int GetKeyPoolSize() const override;
    int64_t GetTimeFirstKey() const override;
    std::unique_ptr<CKeyMetadata> GetMetadata(const CTxDestination& dest) const override;
    bool CanGetAddresses(bool internal = false) const override;
    std::unique_ptr<SigningProvider> GetSolvingProvider(const CScript& script) const override;