mirror of
https://gitlab.com/pulsechaincom/prysm-pulse.git
synced 2024-12-22 19:40:37 +00:00
da20785685
Former-commit-id: 23f542f43b4b493e38f5aa4c29788ed93a63b43b [formerly 71b23a6a28eb045fcfeab6329de69f1e5455486b] Former-commit-id: d12b3a6decc876f010a71f98e11df7387c1aaf2a
89 lines
2.1 KiB
Go
89 lines
2.1 KiB
Go
// Code generated by github.com/fjl/gencodec. DO NOT EDIT.
|
|
|
|
package whisperv6
|
|
|
|
import (
|
|
"encoding/json"
|
|
|
|
"github.com/ethereum/go-ethereum/common/hexutil"
|
|
)
|
|
|
|
var _ = (*newMessageOverride)(nil)
|
|
|
|
func (n NewMessage) MarshalJSON() ([]byte, error) {
|
|
type NewMessage struct {
|
|
SymKeyID string `json:"symKeyID"`
|
|
PublicKey hexutil.Bytes `json:"pubKey"`
|
|
Sig string `json:"sig"`
|
|
TTL uint32 `json:"ttl"`
|
|
Topic TopicType `json:"topic"`
|
|
Payload hexutil.Bytes `json:"payload"`
|
|
Padding hexutil.Bytes `json:"padding"`
|
|
PowTime uint32 `json:"powTime"`
|
|
PowTarget float64 `json:"powTarget"`
|
|
TargetPeer string `json:"targetPeer"`
|
|
}
|
|
var enc NewMessage
|
|
enc.SymKeyID = n.SymKeyID
|
|
enc.PublicKey = n.PublicKey
|
|
enc.Sig = n.Sig
|
|
enc.TTL = n.TTL
|
|
enc.Topic = n.Topic
|
|
enc.Payload = n.Payload
|
|
enc.Padding = n.Padding
|
|
enc.PowTime = n.PowTime
|
|
enc.PowTarget = n.PowTarget
|
|
enc.TargetPeer = n.TargetPeer
|
|
return json.Marshal(&enc)
|
|
}
|
|
|
|
func (n *NewMessage) UnmarshalJSON(input []byte) error {
|
|
type NewMessage struct {
|
|
SymKeyID *string `json:"symKeyID"`
|
|
PublicKey *hexutil.Bytes `json:"pubKey"`
|
|
Sig *string `json:"sig"`
|
|
TTL *uint32 `json:"ttl"`
|
|
Topic *TopicType `json:"topic"`
|
|
Payload *hexutil.Bytes `json:"payload"`
|
|
Padding *hexutil.Bytes `json:"padding"`
|
|
PowTime *uint32 `json:"powTime"`
|
|
PowTarget *float64 `json:"powTarget"`
|
|
TargetPeer *string `json:"targetPeer"`
|
|
}
|
|
var dec NewMessage
|
|
if err := json.Unmarshal(input, &dec); err != nil {
|
|
return err
|
|
}
|
|
if dec.SymKeyID != nil {
|
|
n.SymKeyID = *dec.SymKeyID
|
|
}
|
|
if dec.PublicKey != nil {
|
|
n.PublicKey = *dec.PublicKey
|
|
}
|
|
if dec.Sig != nil {
|
|
n.Sig = *dec.Sig
|
|
}
|
|
if dec.TTL != nil {
|
|
n.TTL = *dec.TTL
|
|
}
|
|
if dec.Topic != nil {
|
|
n.Topic = *dec.Topic
|
|
}
|
|
if dec.Payload != nil {
|
|
n.Payload = *dec.Payload
|
|
}
|
|
if dec.Padding != nil {
|
|
n.Padding = *dec.Padding
|
|
}
|
|
if dec.PowTime != nil {
|
|
n.PowTime = *dec.PowTime
|
|
}
|
|
if dec.PowTarget != nil {
|
|
n.PowTarget = *dec.PowTarget
|
|
}
|
|
if dec.TargetPeer != nil {
|
|
n.TargetPeer = *dec.TargetPeer
|
|
}
|
|
return nil
|
|
}
|