<p>The miner only determines if it is valid. Miners do not, in a sense, "discriminate" between Segwit or Legacy.</p>

CC BY-SA 3.0
2018-03-28T08:36:15.447Z
I think legacy miner(pre-segwit) needs to distinguish between anyone-can-spend transactions and legacy transactions for the simple reason that they can't validate segwit transactions.
sanket1729
CC BY-SA 3.0
2018-03-31T04:55:07.553Z
@sanket1729 No, by definition they can't, as they don't even know about the existance of segwit. All they see is a weird but valid output that anyone can spend. They're not aware of the new rules that do not make them so trivial.
Pieter Wuille
CC BY-SA 3.0
2018-04-01T11:41:01.340Z
@PieterWuille, should there not be any policy in the legacy miners to not include transactions which contain anyone can spend outputs since they cannot risk creating an invalid block?
sanket1729
CC BY-SA 4.0
2021-11-16T21:45:41.040Z
@sanket1729 Sure, there is; in the case of BIP141, that policy rule is the CLEANSTACK rule (which requires the final state of the stack after scriptPubKey execution to contain a single non-zero element): BIP141 scriptPubKeys push **two** elements for exactly that reason. But I still wouldn't quite call that discriminating between segwit and non-segwit, only discriminating based on an old policy rule, which segwit helpfully is designed to trigger.
Pieter Wuille
CC BY-SA 3.0
2018-03-28T01:32:34.743Z
2018-03-28T01:32:34.743Z
CwazyStomper
<p>When a transaction is pushed directly to a miner does it check whether the transaction is segwit or not, or only if it is valid?</p>

<transactions><segregated-witness><validation>
Do miners check whether a transaction is segwit or non-segwit?
Errol
# Do miners check whether a transaction is segwit or non-segwit?

(Asked by: username_0 on 2018-03-28)

When a transaction is pushed directly to a miner does it check whether the transaction is segwit or not, or only if it is valid?

**Tags:** transactions, segregated-witness, validation


---

## 1 answers

### Answer by username_1 on 2018-03-28. Score: 0 | Accepted answer

The miner only determines if it is valid. Miners do not, in a sense, "discriminate" between Segwit or Legacy.

> **Comments:**
> **username_2**: I think legacy miner(pre-segwit) needs to distinguish between anyone-can-spend transactions and legacy transactions for the simple reason that they can't validate segwit transactions.  
> **username_3**: @username_2 No, by definition they can't, as they don't even know about the existance of segwit. All they see is a weird but valid output that anyone can spend. They're not aware of the new rules that do not make them so trivial.  
> **username_2**: @PieterWuille, should there not be any policy in the legacy miners to not include transactions which contain anyone can spend outputs since they cannot risk creating an invalid block?  
> **username_3**: @username_2 Sure, there is; in the case of BIP141, that policy rule is the CLEANSTACK rule (which requires the final state of the stack after scriptPubKey execution to contain a single non-zero element): BIP141 scriptPubKeys push **two** elements for exactly that reason. But I still wouldn't quite call that discriminating between segwit and non-segwit, only discriminating based on an old policy rule, which segwit helpfully is designed to trigger.  

---

