diff --git a/bip-0138.md b/bip-0138.md index a999f92e..06f84d0f 100644 --- a/bip-0138.md +++ b/bip-0138.md @@ -369,7 +369,16 @@ remaining bytes are `PADDING`. A `PAYLOAD` MUST contain at least one item (see `LENGTH`: variable-length integer representing the length of `DATA` in bytes. -For all `TYPE` values except `0x01`, `LENGTH` MUST be present. +For all `TYPE` values except `0x01`, `LENGTH` MUST be present.[^length-required] + +[^length-required]: **Why is `LENGTH` mandatory?** + `LENGTH` is what lets a parser skip a content type it does not implement and still + read the items that follow; without it, the parser cannot know where `DATA` ends. + A string note placed before a descriptor, for example, must not stop an + implementation that only handles descriptors from recovering that descriptor. A + type whose `DATA` is always empty still carries a zero `LENGTH` for this reason. + `0x01` is exempt because every implementation handles it, so it is never skipped + blindly. `DATA`: variable-length field whose encoding depends on `TYPE`.