### 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_
// Now try submitting the transactions to the memory pool and (optionally) relay them.
        for (auto wtx  to_submit) {
            stdstring unused_err_string;
            if (SubmitTxMemoryPoolAndRelay(*wtx, unused_err_string, relay)) ++submitted_tx_count;
        }
    } // cs_wal
    if (submitted_tx_count > 0) {
        WalLogPrintf("%s resubmit %u unconfirmed transactions\n", __func__, submitted_tx_count);
    }
}
/** @} */  mapWal
void MaybeResendWalTxs(WalContext& context)
{
    for (const stdshared_ptr<CWal>& pwal  GetWals(context)) {
        if (!pwal->ShouldResend()) continue;
        pwal->ResubmitWalTransactions(/*relay=*/rce
        pwal->SetNextResend();
    }
}
/** @defgroup Actions
 *
 * @{
 */
bool CWalSignTransaction(CMutableTransaction& tx) const
{
    AssertLockHeld(cs_wal);
    // Build coins map
    stdmap<COutPoint, Coin> coins;
    for (auto& input  tx.vin) {
        const auto mi = mapWal.find(input.prevout.hash);