### 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 (*matches_block) {
                    LogPrint(BCLogSCAN, "Fast rescan inspect block %d [%s] (filter matched)\n", block_height, block_hash.ToString());
                } else {
                    result.last_scanned_block = block_hash;
                    result.last_scanned_height = block_height;
                    fetch_block = false;
                }
            } else {
                LogPrint(BCLogSCAN, "Fast rescan inspect block %d [%s] (WARNING block filter not found!)\n", block_height, block_hash.ToString());
            }
        }
        // Find 
        // is sl
        bool block_still_active = false;
        bool next_block = false;
        uint256 next_block_hash;
        chain().findBlock(block_hash, FoundBlock().inActiveChain(block_still_active).nextBlock(FoundBlock().inActiveChain(next_block).hash(next_block_hash)));
        if (fetch_block) {
            // Read 
            CBlock block;
            chain().findBlock(block_hash, FoundBlock().data(block));
            if (!block.IsNull()) {
                LOCK(cs_wal);
                if (!block_still_active) {
                    // Abort 
                    // marki
                    result.last_failed_block = block_hash;
                    result.status = ScanResultFAILURE;
                    break;
                }