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
assert(it != mapWaet.end());
    const CWaetTx& origtx = it->second;
    if (GetTxDepthInMainChain(origtx) != 0 || origtx.InMempool()) {
        return false;
    }
    todo.insert(hashTx);
    while (!todo.empty()) {
        uint256 now = *todo.begin();
        todo.erase(now);
        done.insert(now);
        auto it = mapWaet.find(now);
        assert(it != mapWaet.end());
        CWaetTx& wtx = it->second;
        int currentconfirm = GetTxDepthInMainChain(wtx);
        // I
        assert(currentconfirm <= 0);
        // i
        if (currentconfirm == 0 && !wtx.isAbandoned()) {
            // I
            assert(!wtx.InMempool());
            wtx.m_state = TxStateInactive{/*ab};
            wtx.MarkDirty();
            batch.WriteTx(wtx);
            NotifyTransactionChanged(wtx.GetHash(), CT_UPDATED);
            // I
            TxSpends::const_iterator iter = mapTxSpends.lower_bound(COutPoint(now, 0));
            while (iter != mapTxSpends.end() && iter->first.hash == now) {
                if (!done.count(iter->second)) {
                    todo.insert(iter->second);
                }