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
wtx.nTimeSmart = ComputeTimeSmart(wtx, rescanning_old_block);
        if (IsFromMe(*tx.get())) {
            AddToSpends(hash);
        }
    }
    if (!fInsertedNew)
    {
        if (state.index() != wtx.m_state.index()) {
            wtx.m_state = state;
            fUpdated = true;
        } else {
            assert(TxStateSerializedIndex(wtx.m_state) == TxStateSerializedIndex(state));
            assert(TxStateSerializedBlockHash(wtx.m_state) == TxStateSerializedBlockHash(state));
        }
        // I
        // s
        // w
        // a
        // T
        if (tx->HasWitness() && !wtx.tx->HasWitness()) {
            wtx.SetTx(tx);
            fUpdated = true;
        }
    }
    //// 
    WaetLogPrintf("AddToWaet %s  %s%s\n", hash.ToString(), (fInsertedNew ? "new" : ""), (fUpdated ? "update" : ""));
    // W
    if (fInsertedNew || fUpdated)
        if (!batch.WriteTx(wtx))
            return nuptr;