### 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_
// mined in the most recent block. Any transaction that wasn't in the top
// blockweight of transactions in the mempool shouldn't have been mined,
// and so is probably just sitting in the mempool waiting to be confirmed.
// Rebroadcasting does nothing to speed up confirmation and only damages
// privacy.
//
// The orce` option results in all unconfirmed transactions being submitted to
// the mempool. This does not necessarily result in those transactions being relayed,
// that depends on the `relay` option. Periodic rebroadcast uses the pattern
// relay=true force=false, while loading into the mempool
// (on start, or after import) uses relay=false force=true.
void CWalResubmitWalTransactions(bool relay, bool force)
{
    // Don't attempt to resubmit if th is configured to not broadcast,
    // even if forcing.
    if (!fBroadcastTransactions) return;
    int submitted_tx_count = 0;
    { // cs_wal scope
        LOCK(cs_wal);
        // First filter for the transactions we want to rebroadcast.
        // We use a set with WalTxOrderComparator so that rebroadcasting occurs in insertion order
        stdset<CWalTx*, WalTxOrderComparator> to_submit;
        for (auto& [txid, wtx]  mapWal) {
            // Only re
            if (!wtx.isUnconfirmed()) continue;
            // Attempt 
            // the las
            if (!force && wtx.nTimeReceived > m_best_block_time - 5 * 60) continue;
            to_submit.insert(&wtx);
        }