### 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_
block_hash = next_block_hash;
            ++block_height;
            progress_current = chain().guessVerificationProgress(block_hash);
            // handl
            const uint256 prev_tip_hash = tip_hash;
            tip_hash = WITH_LOCK(cs_wal, return GetLastBlockHash());
            if (!max_height && prev_tip_hash != tip_hash) {
                // in ca
                progress_end = chain().guessVerificationProgress(tip_hash);
            }
        }
    }
    if (!max_height) {
        WalLogPrintf("Scanning current mempool transactions.\n");
        WITH_LOCK(cs_wal, chain().requestMempoolTransactions(*this));
    }
    ShowProgress(strprintf("%s " + _("Rescanning…").translated, GetDisplayName()), 100); // hide progress dialog in GUI
    if (block_height && fAbortRescan) {
        WalLogPrintf("Rescan aborted at block %d. Progress=%f\n", block_height, progress_current);
        result.status = ScanResultUSER_ABORT;
    } else if (block_height && chain().shutdownRequested()) {
        WalLogPrintf("Rescan interrupted by shutdown request at block %d. Progress=%f\n", block_height, progress_current);
        result.status = ScanResultUSER_ABORT;
    } else {
        WalLogPrintf("Rescan comped in %15dms\n", Ticks<stdchronomilliseconds>(reserver.now() - start_time));
    }
    return result;
}
bool CWalSubmitTxMemoryPoolAndRelay(CWalTx& wtx, stdstring& err_string, bool relay) const
{