@@ -23,7 +23,7 @@ func (v Validator) Verify(nodeInfo netmap.NodeInfo) error {
23
23
var results []* client.ResEndpointInfo
24
24
var err error
25
25
26
- for s := range func ( f func ( string ) bool ) { nodeInfo .IterateNetworkEndpoints ( func ( s string ) bool { return ! f ( s ) }) } {
26
+ for s := range nodeInfo .NetworkEndpoints () {
27
27
var res * client.ResEndpointInfo
28
28
var c * client.Client
29
29
@@ -75,8 +75,6 @@ func compareNodeInfos(niExp, niGot netmap.NodeInfo) error {
75
75
return nil
76
76
}
77
77
78
- var err error
79
-
80
78
if exp , got := niExp .PublicKey (), niGot .PublicKey (); ! bytes .Equal (exp , got ) {
81
79
return fmt .Errorf ("public key: got %x, expect %x" , got , exp )
82
80
}
@@ -85,26 +83,23 @@ func compareNodeInfos(niExp, niGot netmap.NodeInfo) error {
85
83
return fmt .Errorf ("attr number: got %d, expect %d" , got , exp )
86
84
}
87
85
88
- niExp . IterateAttributes ( func ( key , value string ) {
86
+ for key , value := range niExp . Attributes ( ) {
89
87
vGot := niGot .Attribute (key )
90
88
if vGot != value {
91
- err = fmt .Errorf ("non-equal %s attribute: got %s, expect %s" , key , vGot , value )
89
+ return fmt .Errorf ("non-equal %s attribute: got %s, expect %s" , key , vGot , value )
92
90
}
93
- })
94
- if err != nil {
95
- return err
96
91
}
97
92
98
93
if exp , got := niExp .NumberOfNetworkEndpoints (), niGot .NumberOfNetworkEndpoints (); exp != got {
99
94
return fmt .Errorf ("address number: got %d, expect %d" , got , exp )
100
95
}
101
96
102
97
expAddrM := make (map [string ]struct {}, niExp .NumberOfAttributes ())
103
- for s := range func ( f func ( string ) bool ) { niExp .IterateNetworkEndpoints ( func ( s string ) bool { return ! f ( s ) }) } {
98
+ for s := range niExp .NetworkEndpoints () {
104
99
expAddrM [s ] = struct {}{}
105
100
}
106
101
107
- for s := range func ( f func ( string ) bool ) { niGot .IterateNetworkEndpoints ( func ( s string ) bool { return ! f ( s ) }) } {
102
+ for s := range niGot .NetworkEndpoints () {
108
103
if _ , ok := expAddrM [s ]; ! ok {
109
104
return fmt .Errorf ("got unexpected address: %s" , s )
110
105
}
0 commit comments