From 91e46848c51c80c3f87860d61a2554d350b9a842 Mon Sep 17 00:00:00 2001 From: Tolik Zinovyev Date: Thu, 19 Aug 2021 18:19:59 -0400 Subject: [PATCH] Add comments for protocol hash IDs and tags. --- protocol/hash.go | 3 ++- protocol/tags.go | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/protocol/hash.go b/protocol/hash.go index 1f70fc6838..808a7ead2c 100644 --- a/protocol/hash.go +++ b/protocol/hash.go @@ -20,7 +20,8 @@ package protocol // This ensures, for example, the hash of a transaction will never collide with the hash of a vote type HashID string -// Hash IDs for specific object types, in lexicographic order to avoid dups. +// Hash IDs for specific object types, in lexicographic order. +// Hash IDs must be PREFIX-FREE (no hash ID is a prefix of another). const ( AuctionBid HashID = "aB" AuctionDeposit HashID = "aD" diff --git a/protocol/tags.go b/protocol/tags.go index 7f448a762b..0cab256282 100644 --- a/protocol/tags.go +++ b/protocol/tags.go @@ -23,6 +23,7 @@ type Tag string // Tags, in lexicographic sort order of tag values to avoid duplicates. // These tags must not contain a comma character because lists of tags // are encoded using a comma separator (see network/msgOfInterest.go). +// The tags must be 2 bytes long. const ( UnknownMsgTag Tag = "??" AgreementVoteTag Tag = "AV"