This would allow wallet operations like funding transactions with smart contract-based inputs such as LN, or any input the Core wallet doesn't know how to sign for.

https://github.com/bitcoin/bitcoin/pull/17211#issuecomment-933674310
{
        const uint256& wtxid = entry.first;
        const CWalletTx& wtx = entry.second;
        if (!wallet.chain().checkFinalTx(*wtx.tx)) {
            continue;
        }
        if (wallet.IsTxImmatureCoinBase(wtx))
            continue;
        int nDepth = wallet.GetTxDepthInMainChain(wtx);
        if (nDepth < 0)
            continue;
        
        
        if (nDepth == 0 && !wtx.InMempool())
            continue;
        bool safeTx = CachedTxIsTrusted(wallet, wtx, trusted_parents);