-
Notifications
You must be signed in to change notification settings - Fork 0
/
shardHeader.go
90 lines (75 loc) · 2.36 KB
/
shardHeader.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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
package headerVersionData
import "math/big"
// HeaderAdditionalData holds getters for the additional version related header data for new versions
// for future versions this interface can grow
type HeaderAdditionalData interface {
GetScheduledRootHash() []byte
GetScheduledAccumulatedFees() *big.Int
GetScheduledDeveloperFees() *big.Int
GetScheduledGasProvided() uint64
GetScheduledGasPenalized() uint64
GetScheduledGasRefunded() uint64
IsInterfaceNil() bool
}
// AdditionalData holds the additional version related header data
// for future header versions this structure can grow
type AdditionalData struct {
ScheduledRootHash []byte
ScheduledAccumulatedFees *big.Int
ScheduledDeveloperFees *big.Int
ScheduledGasProvided uint64
ScheduledGasPenalized uint64
ScheduledGasRefunded uint64
}
// GetScheduledRootHash returns the scheduled RootHash
func (ad *AdditionalData) GetScheduledRootHash() []byte {
if ad == nil {
return nil
}
return ad.ScheduledRootHash
}
// GetScheduledAccumulatedFees returns the accumulated fees on scheduled SC calls
func (ad *AdditionalData) GetScheduledAccumulatedFees() *big.Int {
if ad == nil {
return nil
}
if ad.ScheduledAccumulatedFees == nil {
return big.NewInt(0)
}
return big.NewInt(0).Set(ad.ScheduledAccumulatedFees)
}
// GetScheduledDeveloperFees returns the developer fees on scheduled SC calls
func (ad *AdditionalData) GetScheduledDeveloperFees() *big.Int {
if ad == nil {
return nil
}
if ad.ScheduledDeveloperFees == nil {
return big.NewInt(0)
}
return big.NewInt(0).Set(ad.ScheduledDeveloperFees)
}
// GetScheduledGasProvided returns the gas provided on scheduled SC calls for previous block
func (ad *AdditionalData) GetScheduledGasProvided() uint64 {
if ad == nil {
return 0
}
return ad.ScheduledGasProvided
}
// GetScheduledGasPenalized returns the gas penalized on scheduled SC calls for previous block
func (ad *AdditionalData) GetScheduledGasPenalized() uint64 {
if ad == nil {
return 0
}
return ad.ScheduledGasPenalized
}
// GetScheduledGasRefunded returns the gas refunded on scheduled SC calls for previous block
func (ad *AdditionalData) GetScheduledGasRefunded() uint64 {
if ad == nil {
return 0
}
return ad.ScheduledGasRefunded
}
// IsInterfaceNil returns true if there is no value under the interface
func (ad *AdditionalData) IsInterfaceNil() bool {
return ad == nil
}