From 9a51b508e8b551aa94e784c376f3d5069ceffc7c Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Wed, 20 May 2020 12:38:11 +0300 Subject: [PATCH] Use loop label in InnerRingUpdate call handler --- neofs_contract.go | 26 +++++++++----------------- 1 file changed, 9 insertions(+), 17 deletions(-) diff --git a/neofs_contract.go b/neofs_contract.go index 492e252..bab6b25 100644 --- a/neofs_contract.go +++ b/neofs_contract.go @@ -230,35 +230,27 @@ func Main(op string, args []interface{}) interface{} { offset = 10 newIR := []node{} - for i := 0; i < listItemCount; i++ { + loop: + for i := 0; i < listItemCount; i, offset = i+1, offset+33 { pub := data[offset : offset+33] - finished := false - for j := 0; j < len(irList); j++ { n := irList[j] if util.Equals(n.pub, pub) { newIR = append(newIR, n) - finished = true - break + continue loop } } - if !finished { - for j := 0; j < len(candidates); j++ { - n := candidates[j] - if util.Equals(n.pub, pub) { - newIR = append(newIR, n) - finished = true - break - } - } - if !finished { - panic("unknown inner ring candidate present in the list") + for j := 0; j < len(candidates); j++ { + n := candidates[j] + if util.Equals(n.pub, pub) { + newIR = append(newIR, n) + continue loop } } - offset += 33 } + if len(newIR) != listItemCount { panic("new inner ring wasn't processed correctly") }