@@ -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
@@ -85,26 +85,23 @@ func compareNodeInfos(niExp, niGot netmap.NodeInfo) error {
85
85
return fmt .Errorf ("attr number: got %d, expect %d" , got , exp )
86
86
}
87
87
88
- niExp . IterateAttributes ( func ( key , value string ) {
88
+ for key , value := range niExp . Attributes ( ) {
89
89
vGot := niGot .Attribute (key )
90
90
if vGot != value {
91
- err = fmt .Errorf ("non-equal %s attribute: got %s, expect %s" , key , vGot , value )
91
+ return fmt .Errorf ("non-equal %s attribute: got %s, expect %s" , key , vGot , value )
92
92
}
93
- })
94
- if err != nil {
95
- return err
96
93
}
97
94
98
95
if exp , got := niExp .NumberOfNetworkEndpoints (), niGot .NumberOfNetworkEndpoints (); exp != got {
99
96
return fmt .Errorf ("address number: got %d, expect %d" , got , exp )
100
97
}
101
98
102
99
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 ) }) } {
100
+ for s := range niExp .NetworkEndpoints () {
104
101
expAddrM [s ] = struct {}{}
105
102
}
106
103
107
- for s := range func ( f func ( string ) bool ) { niGot .IterateNetworkEndpoints ( func ( s string ) bool { return ! f ( s ) }) } {
104
+ for s := range niGot .NetworkEndpoints () {
108
105
if _ , ok := expAddrM [s ]; ! ok {
109
106
return fmt .Errorf ("got unexpected address: %s" , s )
110
107
}
0 commit comments