0

If an INV type unknown to the node appears in an INV message, a GETDATA message or some other message where the INVETORY structure is used (e.g. MSG_WITNESS_TX for non-segWit nodes, MSG_WITNESS_TX in an INV message for segWit/non-segWit node, some random INV type, etc.) , is the whole message then considered invalid or only that "row" in the message is skipped/ignored, while the other rows and the rest of the message are processed?

Cosmos
  • 199
  • 7

1 Answers1

1

In Bitcoin Core, as of version 26.0, INV entries of unknown type are ignored and skipped (and optionally logged, if "net" debugging is on); later entries in the same message are still processed.

On incoming INV messages, MSG_WITNESS_TX is treated the same as MSG_TX, and MSG_FILTERED_BLOCK, MSG_CMPCT_BLOCK and MSG_WITNESS_BLOCK are treated the same as MSG_BLOCK.

Pieter Wuille
  • 105,497
  • 9
  • 194
  • 308
  • Does it apply to all messages in which the given structure (INV) appears or are there exceptions? – Cosmos Dec 19 '23 at 00:35
  • I ask because only MSG_TX and MSG_BLOCK should appear in INV messages, but what if MSG_WITNESS_TX or MSG_WITNESS_BLOCK appears. They are a known type to the segWit node, but should not appear in the INV message. Are such rows ignored or the message is considered as invalid and rejected? – Cosmos Dec 19 '23 at 00:43
  • 1
    Updated my answer. – Pieter Wuille Dec 19 '23 at 01:18
  • @MudjaAdjum My answer is specifically about Bitcoin Core 26.0, which does support segwit. "updating to segwit" has no meaning here; you need to talk about specific versions of specific software. There is no guarantee that any other version/implementation behaves similarly. – Pieter Wuille Dec 19 '23 at 02:00
  • I meant Bitcoin Core. When I wrote "if it was not updated to segWit" I was referring to Bitcoin Core versions before segWit, and their behavior when they received in the INV message, for example, MSG_WITNESS_TX. – Cosmos Dec 19 '23 at 02:16
  • But even within versions of Bitcoin Core, the situation is more complicated. E.g. (random example) it appears that 0.14.0 would not treat invs with MSG_CMPCT_BLOCK like MSG_BLOCK while 26.0 does. There are no specifications for how a node behaves when arbitrarily wrong data sent to it, so different pieces of software (even different versions) may behave differently. – Pieter Wuille Dec 19 '23 at 03:38
  • MSG_WITNESS_TX and MSG_WITNESS_BLOCK were introduced with the SegWit update. Nodes that have not updated to SegWit do not know this INVENTORY type. Since you wrote that if a node receives INV entries of an unknown type, they are skipped, I wanted to add a note that if a non-SegWit node received such an entry in the INV message, it would be just ignored since for that (non-segWit) node MSG_WITNESS_TX is unknown and MSG_WITNESS_TX == MSG_TX is not true. – Cosmos Dec 19 '23 at 04:25
  • 1
    @MudjaAdjum Yes, my point is that you have to be specific about what versions of what software you're talking about. E.g. 0.13.0 also treats MSG_WITNESS_TX as MSG_TX, but didn't have segwit active (that only happened in 0.13.1). – Pieter Wuille Dec 19 '23 at 08:30
  • You are right. I should have denoted the version I was talking about. My bad – Cosmos Dec 19 '23 at 17:27