-
Notifications
You must be signed in to change notification settings - Fork 82
/
gen_pbftSign_json.go
56 lines (50 loc) · 1.14 KB
/
gen_pbftSign_json.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
// Code generated by github.com/fjl/gencodec. DO NOT EDIT.
package types
import (
"encoding/json"
"math/big"
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/common/hexutil"
)
var _ = (*pbftSignMarshaling)(nil)
// MarshalJSON marshals as JSON.
func (p PbftSign) MarshalJSON() ([]byte, error) {
type PbftSign struct {
FastHeight *hexutil.Big
FastHash common.Hash
Result uint32
Sign hexutil.Bytes
}
var enc PbftSign
enc.FastHeight = (*hexutil.Big)(p.FastHeight)
enc.FastHash = p.FastHash
enc.Result = p.Result
enc.Sign = p.Sign
return json.Marshal(&enc)
}
// UnmarshalJSON unmarshals from JSON.
func (p *PbftSign) UnmarshalJSON(input []byte) error {
type PbftSign struct {
FastHeight *hexutil.Big
FastHash *common.Hash
Result *uint32
Sign *hexutil.Bytes
}
var dec PbftSign
if err := json.Unmarshal(input, &dec); err != nil {
return err
}
if dec.FastHeight != nil {
p.FastHeight = (*big.Int)(dec.FastHeight)
}
if dec.FastHash != nil {
p.FastHash = *dec.FastHash
}
if dec.Result != nil {
p.Result = *dec.Result
}
if dec.Sign != nil {
p.Sign = *dec.Sign
}
return nil
}