mirror of
https://gitlab.com/pulsechaincom/prysm-pulse.git
synced 2024-12-22 03:30:35 +00:00
master
21 lines
728 B
Diff
21 lines
728 B
Diff
diff --git a/proto/equal.go b/proto/equal.go
|
|||
index d4db5a1c..649100f9 100644
|
|||
--- a/proto/equal.go
|
|||
+++ b/proto/equal.go
|
|||
@@ -202,6 +202,15 @@ func equalAny(v1, v2 reflect.Value, prop *Properties) bool {
|
|||
if v1.IsNil() != v2.IsNil() {
|
|||
return false
|
|||
}
|
|||
+ // Edge case: if field is a cast type of []byte, special conversion
|
|||
+ // to []byte is required for bytes.Equal.
|
|||
+ if v1.Type() != reflect.TypeOf([]byte{}) {
|
|||
+ w1 := reflect.New(reflect.TypeOf([]byte{})).Elem()
|
|||
+ w2 := reflect.New(reflect.TypeOf([]byte{})).Elem()
|
|||
+ w1.Set(v1)
|
|||
+ w2.Set(v2)
|
|||
+ return bytes.Equal(w1.Interface().([]byte), w2.Interface().([]byte))
|
|||
+ }
|
|||
return bytes.Equal(v1.Interface().([]byte), v2.Interface().([]byte))
|
|||
}
|
|||
|