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?

3

When forwarding the block to a non-segwit peer, a segwit-enabled node strips the witness data from the block before transmission, including marker and flag. Note that the stripped blocks still enable the non-segwit peers to arrive at the same UTXO set, since the stripped transactions specify which inputs get spent and which new outputs get created.

If a segwit-enabled node were to receive a stripped block, it would consider the block invalid due to the missing witness data on transactions with segwit inputs (and the presence of a witness commitment). Thus, a segwit-enabled node will not requests blocks from non-segwit peers as they wouldn't be able to provide the complete block anyway (unless the block had no segwit transactions and no witness commitment).

Segwit inputs were designed so that non-segwit nodes consider segwit transactions valid but non-standard. Non-standard transactions are not accepted into the mempool and thus not relayed. This means that non-segwit nodes will not relay (stripped) segwit transactions except in the context of a new block. In turn, this makes it safe for segwit nodes to request transaction inventory offered by non-segwit peers, since non-segwit peers will only offer non-segwit transactions.

0

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.