In
|
func (c *Controller) Decode(data []byte) error { |
|
err := json.Unmarshal(data, &c) |
|
if err != nil { |
|
return errors.Wrap(err, "could not decode controller") |
|
} |
|
|
|
config := c.GetConfig() |
|
for _, i := range c.StoredInstances { |
|
if i != nil { |
|
i.config = config |
|
} |
|
} |
|
return nil |
|
} |
there seems to be a mistake.
err := json.Unmarshal(data, &c)
Here, c is a pointer receiver (*Controller), so &c is a pointer to a pointer (**Controller), which is not what json.Unmarshal expects. This results in unexpect deserialization.
Same issue in instance decoding.
In
ssv-spec/qbft/json_testutils.go
Lines 22 to 35 in 3bd357a
Here, c is a pointer receiver (*Controller), so &c is a pointer to a pointer (**Controller), which is not what json.Unmarshal expects. This results in unexpect deserialization.
Same issue in
instancedecoding.