BIP141 says wtxid is SHA256 of [nVersion][marker][flag][txins][txouts][witness][nLockTime]. Is data that hashed as txid includes witness?
And will txid be presented in block, e.g. be counted when building Merkle tree?
BIP141 says wtxid is SHA256 of [nVersion][marker][flag][txins][txouts][witness][nLockTime]. Is data that hashed as txid includes witness?
And will txid be presented in block, e.g. be counted when building Merkle tree?
Is data that hashed as txid includes witness?
No, the txid is the hash of just [nVersion][txins][txouts][nLockTime]
which is the same as a serialized non-witness transaction. That means the signature is not included in the transaction hash, removing the potential for TXID malleability due to mauling the signature. Only WTXID contains the witness, marker and flag as you wrote in your post.
And will txid be presented in block, e.g. be counted when building Merkle tree?
Yes, the transaction ID is used in the same way that non-segwit TXIDs are used when building the merkle tree.