From e05e34ab4b99a4fb44d89150ee2eae5821a67d0e Mon Sep 17 00:00:00 2001 From: Joost Jager Date: Tue, 20 Aug 2019 09:55:30 +0200 Subject: [PATCH] BOLT 1: Define custom tlv record range --- 01-messaging.md | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/01-messaging.md b/01-messaging.md index 4ed85ade9..d2bcdc3e0 100644 --- a/01-messaging.md +++ b/01-messaging.md @@ -108,7 +108,11 @@ messages, a `tlv_stream` is typically placed after all currently defined fields. The `type` is a varint encoded using the BigSize format. It functions as a message-specific, 64-bit identifier for the `tlv_record` determining how the -contents of `value` should be decoded. +contents of `value` should be decoded. `type` identifiers below 2^16 are +reserved for use in this specification. `type` identifiers greater than or equal +to 2^16 are available for custom records. Any record not defined in this +specification is considered a custom record. This includes experimental and +application-specific messages. The `length` is a varint encoded using the BigSize format signaling the size of `value` in bytes. @@ -121,6 +125,13 @@ according to the message-specific format determined by `type`. The sending node: - MUST order `tlv_record`s in a `tlv_stream` by monotonically-increasing `type`. - MUST minimally encode `type` and `length`. + - When defining custom record `type` identifiers: + - SHOULD pick random `type` identifiers to avoid collision with other + custom types. + - SHOULD pick odd `type` identifiers when regular nodes should ignore the + additional data. + - SHOULD pick even `type` identifiers when regular nodes should reject the + full tlv stream containing the custom record. - SHOULD NOT use redundant, variable-length encodings in a `tlv_record`. The receiving node: