2
I've read all the relevant BIPs, and am still confused.
Are segwit enabled blocks stripped of witness data and marker and flag bytes when they are propagated to non-segwit peers? Or are they just serialized in such a way as to ignore the those bytes?
It is my understanding that blocks containing segwit transactions may have the witnesses, flag, and version bytes in them, or may not - depending on where that block is being propagated from. If it is coming from a non-segwit node, the transactions will be stripped. However, what happens when a stripped-witness block then reaches a Segwit-enabled node? How will it know that those transactions are actually segwit and are just missing the relevant data? Do they compare the txid's to txids in their cache and fill in the data?
Follow up question: what is the process/flow for individual transaction messages? Do their contents also depend on what type of node is asking for them?
Marker and flag bytes are stripped too, correct? – Mason – 2019-11-19T19:50:00.680
Yes,
markerandflagare part of the witness data. – Murch – 2019-11-19T21:12:02.083Then what benefit does the legacy node even get by receiving a stripped transaction? Will they try and include it in blocks? – Mason – 2019-11-19T21:25:07.687
Lets say im trying to cache tons of transactions by
txid, and im receiving them from both segwit and legacy nodes. I'm going to have an issue where depending on which type I receive first, I may have stripped transactions and witness transactions, correct? – Mason – 2019-11-19T21:26:49.720I guess, but you could simply overwrite with the full transaction when you receive that on your full node. If you need the stripped transactions for some reasons, you can easily calculate them from the complete transactions. Why would you even want to run a pre-segwit node that only enforces a subset of the consensus rules? What are you trying to do? Your line of questioning seems fairly hypothetical or academic. – Murch – 2019-11-19T21:42:17.893
I'm trying to measure block and transaction propagation, and part of that involves caching transactions from both types of nodes. I really appreciate the help. I was hoping there was some way of identifying a transaction as stripped, but it doesnt seem to be the case. Maybe I can consider caching on
txhashas well astxid. Thanks again. – Mason – 2019-11-19T21:49:42.357@Mason: Well, a pre-segwit node would only ever receive the stripped transaction and the segwit node would only ever receive the complete transactions. You could simply measure when each shows up on the respective node first, but there have been significant relay improvements in the past 3.5 years since 0.12.0 (the last pre-segwit version), which may distort what you're trying to measure. – Murch – 2019-11-19T21:56:20.810
Oh, I missed your previous question about the benefit of the stripped transaction for the legacy node: the legacy node would consider the segwit transaction non-standard and not relay it, but the stripped transaction looks standard to it and can be forwarded among legacy nodes. Legacy nodes simply don't enforce all consensus rules, because they don't see the full transactions or complete blocks. The stripped txes and blocks are exclusively a means to be forward compatible to legacy nodes. – Murch – 2019-11-19T21:58:14.210
Let us continue this discussion in chat.
– Mason – 2019-11-19T22:05:20.820