My understanding is that wallets can avoid creating malleable transactions. If so, why does a lightning network need SegWit or some other tx malleability fix?
2 Answers
My understanding is that wallets can avoid creating malleable transactions.
It depends. For typical transactions, standardness rules on the network make malleated transactions unlikely to be relayed and confirmed. But this is just based on goodwill of the network and miners. As was shown recently, it's trivial for miners to stop enforcing this. As there are no consensus rules that prevent malleated transactions from confirming, generally every transaction is at risk.
Perhaps what you are referring to is that good wallet software can cope with malleability. They detect when a modified version of their transactions gets confirmed, and treat it as a replacement for the original. For simple payments, this is usually sufficient.
If so, why does a lightning network need SegWit or some other tx malleability fix?
Because Lightning does something that regular transactions don't do: rely on having pre-signed transactions depending on unbroadcasted potential future transactions, and expecting them to not be invalidated. Malleability breaks this assumption.
My understanding is that wallets can avoid creating malleable transactions
no. today any regular transaction can be malleated, no matter how it was created