mirror of
https://github.com/OffchainLabs/prysm.git
synced 2026-01-10 07:58:22 -05:00
Fix payloadStatusJSON fields (#10246)
* Use pointers * Use pointers * Use pointers * Update json_marshal_unmarshal.go Co-authored-by: prylabs-bulldozer[bot] <58059840+prylabs-bulldozer[bot]@users.noreply.github.com>
This commit is contained in:
@@ -270,17 +270,18 @@ func (p *PayloadAttributes) UnmarshalJSON(enc []byte) error {
|
||||
}
|
||||
|
||||
type payloadStatusJSON struct {
|
||||
LatestValidHash hexutil.Bytes `json:"latestValidHash"`
|
||||
Status string `json:"status"`
|
||||
ValidationError string `json:"validationError"`
|
||||
LatestValidHash *hexutil.Bytes `json:"latestValidHash"`
|
||||
Status string `json:"status"`
|
||||
ValidationError *string `json:"validationError"`
|
||||
}
|
||||
|
||||
// MarshalJSON --
|
||||
func (p *PayloadStatus) MarshalJSON() ([]byte, error) {
|
||||
hash := p.LatestValidHash
|
||||
return json.Marshal(payloadStatusJSON{
|
||||
LatestValidHash: p.LatestValidHash,
|
||||
LatestValidHash: (*hexutil.Bytes)(&hash),
|
||||
Status: p.Status.String(),
|
||||
ValidationError: p.ValidationError,
|
||||
ValidationError: &p.ValidationError,
|
||||
})
|
||||
}
|
||||
|
||||
@@ -291,9 +292,9 @@ func (p *PayloadStatus) UnmarshalJSON(enc []byte) error {
|
||||
return err
|
||||
}
|
||||
*p = PayloadStatus{}
|
||||
p.LatestValidHash = dec.LatestValidHash
|
||||
p.LatestValidHash = *dec.LatestValidHash
|
||||
p.Status = PayloadStatus_Status(PayloadStatus_Status_value[dec.Status])
|
||||
p.ValidationError = dec.ValidationError
|
||||
p.ValidationError = *dec.ValidationError
|
||||
return nil
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user