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?


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

  • 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
    Mar 28 '18 at 8:36
  • @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. Mar 31 '18 at 4:55
  • @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
    Apr 1 '18 at 11:41
  • @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. Nov 16 at 21:45

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.