SegWit is probably the only soft-fork in Bitcoin that was introduced terribly in the social media that is still causing confusion to this day.
First, I hear that the Witness structure can be pruned, which got me thinking. Even though the Witness data isn’t part of the txid, wouldn’t there be issues when a new node downloads a block with pruned transactions and tries to verify that those transactions are still valid? Wouldn’t that new node reject the block because it doesn’t meet SegWit consensus rules/contract?
In order for a true Full Node to verify everything, they will need every part of the transaction. You can NOT prune (common term is strip) witness from a transaction and still verify it. And Full Nodes do NOT strip witness from transactions since witness is part and parcel of it.
What you are referring to here is what Full Nodes do for other older no-longer-full-node clients. In order to keep backward compatibility and help old clients (owners are too lazy to upgrade) still sync and catch up, they give these old nodes a stripped block to
partially verify. Because these old clients are no longer performing a full verification on blocks they can not be called a Full [Verifying] Node anymore.
Secondly, I’ve been wondering what would happen if people started using old versions of Bitcoin Core that don’t fully support SegWit. For example, these older nodes might accept transactions with invalid SegWit data by default (which means invalid transactions), since they just accept this transactions as ANY can Spend. Could this be a security risk? I know it’s unlikely to happen now, but I’m curious about how this issue was handled when SegWit was first being deployed.
This attack can only happen in a very specific way targeting a very specific victim and it can be easily avoided.
If an attacker spends any SegWit output (without having the key and only using the pre-SegWit rules), they will also have to mine that transaction and create a block that would be invalid.
What happens is that this block will be rejected by all full nodes and only accepted by old (pre-SegWit) nodes.
Here is two problems with this attack:
1. It is extremely costly because the attacker has mined an invalid block meaning they've wasted mining power and missed out on the block reward (that's about $200k) since supermajority of the network rejects that block.
2. The old client accepts this as a valid block but it will soon become a stale chain that can not grow as fast as the actual chain. In Bitcoin all nodes (from day one) always follow the chain with the most work. Meaning if the victim of this attack simply waits for more than one confirmation, they won't get scammed since the malicious block will be rejected by their old node as well, as the actual chain grows and they switch to that valid chain as the chain with the most work.