From 88bc9eeb2638fb9142b04ea4f401814bce6b5270 Mon Sep 17 00:00:00 2001 From: Evgenii Stratonikov Date: Sat, 5 Apr 2025 10:31:05 +0300 Subject: [PATCH] [#356] netmap: Check for attribute duplicates in NodeInfo.readFromV2() Signed-off-by: Evgenii Stratonikov --- netmap/node_info.go | 1 + netmap/node_info_test.go | 1 - 2 files changed, 1 insertion(+), 1 deletion(-) diff --git a/netmap/node_info.go b/netmap/node_info.go index ce3bdb9..63fe047 100644 --- a/netmap/node_info.go +++ b/netmap/node_info.go @@ -52,6 +52,7 @@ func (x *NodeInfo) readFromV2(m netmap.NodeInfo, checkFieldPresence bool) error } else if _, ok := mAttr[key]; ok { return fmt.Errorf("duplicate attributes %s", key) } + mAttr[key] = struct{}{} switch { case key == attrCapacity: diff --git a/netmap/node_info_test.go b/netmap/node_info_test.go index bf6e637..65ea0e8 100644 --- a/netmap/node_info_test.go +++ b/netmap/node_info_test.go @@ -271,7 +271,6 @@ func TestNodeInfo_Unmarshal(t *testing.T) { fmt.Sprintf("invalid %s attribute", attrCapacity)) }) t.Run("duplicate attributes", func(t *testing.T) { - t.Skip("FIXME") n := goodNodeInfo() var a netmap.Attribute