-
Notifications
You must be signed in to change notification settings - Fork 0
/
trigger.go
193 lines (169 loc) · 5.25 KB
/
trigger.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
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
//go:generate protoc -I=. -I=$GOPATH/src -I=$GOPATH/src/github.com/numbatx/protobuf/protobuf --gogoslick_out=. trigger.proto
package block
import "github.com/ThotaGopichandThota/gn-core3/data"
// GetEpochStartHeaderHandler returns the epoch start headerHandler
func (str *ShardTriggerRegistry) GetEpochStartHeaderHandler() data.HeaderHandler {
if str == nil {
return nil
}
return str.GetEpochStartShardHeader()
}
// SetIsEpochStart sets the isEpochStart flag
func (str *ShardTriggerRegistry) SetIsEpochStart(isEpochStart bool) error {
if str == nil {
return data.ErrNilPointerReceiver
}
str.IsEpochStart = isEpochStart
return nil
}
// SetNewEpochHeaderReceived sets the newEpochHeaderReceived flag
func (str *ShardTriggerRegistry) SetNewEpochHeaderReceived(newEpochHeaderReceived bool) error {
if str == nil {
return data.ErrNilPointerReceiver
}
str.NewEpochHeaderReceived = newEpochHeaderReceived
return nil
}
// SetEpoch sets the epoch
func (str *ShardTriggerRegistry) SetEpoch(epoch uint32) error {
if str == nil {
return data.ErrNilPointerReceiver
}
str.Epoch = epoch
return nil
}
// SetMetaEpoch Sets the metaChain epoch
func (str *ShardTriggerRegistry) SetMetaEpoch(metaEpoch uint32) error {
if str == nil {
return data.ErrNilPointerReceiver
}
str.MetaEpoch = metaEpoch
return nil
}
// SetCurrentRoundIndex sets the current round index
func (str *ShardTriggerRegistry) SetCurrentRoundIndex(roundIndex int64) error {
if str == nil {
return data.ErrNilPointerReceiver
}
str.CurrentRoundIndex = roundIndex
return nil
}
// SetEpochStartRound sets the epoch start round
func (str *ShardTriggerRegistry) SetEpochStartRound(startRound uint64) error {
if str == nil {
return data.ErrNilPointerReceiver
}
str.EpochStartRound = startRound
return nil
}
// SetEpochFinalityAttestingRound sets the epoch finality attesting round
func (str *ShardTriggerRegistry) SetEpochFinalityAttestingRound(finalityAttestingRound uint64) error {
if str == nil {
return data.ErrNilPointerReceiver
}
str.EpochFinalityAttestingRound = finalityAttestingRound
return nil
}
// SetEpochMetaBlockHash sets the epoch metaChain block hash
func (str *ShardTriggerRegistry) SetEpochMetaBlockHash(epochMetaBlockHash []byte) error {
if str == nil {
return data.ErrNilPointerReceiver
}
str.EpochMetaBlockHash = epochMetaBlockHash
return nil
}
// SetEpochStartHeaderHandler sets the epoch start header
func (str *ShardTriggerRegistry) SetEpochStartHeaderHandler(epochStartHeaderHandler data.HeaderHandler) error {
if str == nil {
return data.ErrNilPointerReceiver
}
var ok bool
str.EpochStartShardHeader, ok = epochStartHeaderHandler.(*Header)
if !ok {
return data.ErrInvalidTypeAssertion
}
return nil
}
// GetEpochStartHeaderHandler returns the epoch start headerHandler
func (strV2 *ShardTriggerRegistryV2) GetEpochStartHeaderHandler() data.HeaderHandler {
if strV2 == nil {
return nil
}
return strV2.GetEpochStartShardHeader()
}
// SetIsEpochStart sets the isEpochStart flag
func (strV2 *ShardTriggerRegistryV2) SetIsEpochStart(isEpochStart bool) error {
if strV2 == nil {
return data.ErrNilPointerReceiver
}
strV2.IsEpochStart = isEpochStart
return nil
}
// SetNewEpochHeaderReceived sets the neeEpochHeaderReceived flag
func (strV2 *ShardTriggerRegistryV2) SetNewEpochHeaderReceived(newEpochHeaderReceived bool) error {
if strV2 == nil {
return data.ErrNilPointerReceiver
}
strV2.NewEpochHeaderReceived = newEpochHeaderReceived
return nil
}
// SetEpoch sets the epoch
func (strV2 *ShardTriggerRegistryV2) SetEpoch(epoch uint32) error {
if strV2 == nil {
return data.ErrNilPointerReceiver
}
strV2.Epoch = epoch
return nil
}
// SetMetaEpoch sets the metaChain epoch
func (strV2 *ShardTriggerRegistryV2) SetMetaEpoch(metaEpoch uint32) error {
if strV2 == nil {
return data.ErrNilPointerReceiver
}
strV2.MetaEpoch = metaEpoch
return nil
}
// SetCurrentRoundIndex sets the current round index
func (strV2 *ShardTriggerRegistryV2) SetCurrentRoundIndex(roundIndex int64) error {
if strV2 == nil {
return data.ErrNilPointerReceiver
}
strV2.CurrentRoundIndex = roundIndex
return nil
}
// SetEpochStartRound sets the epoch start round
func (strV2 *ShardTriggerRegistryV2) SetEpochStartRound(startRound uint64) error {
if strV2 == nil {
return data.ErrNilPointerReceiver
}
strV2.EpochStartRound = startRound
return nil
}
// SetEpochFinalityAttestingRound sets the epoch finality attesting round
func (strV2 *ShardTriggerRegistryV2) SetEpochFinalityAttestingRound(finalityAttestingRound uint64) error {
if strV2 == nil {
return data.ErrNilPointerReceiver
}
strV2.EpochFinalityAttestingRound = finalityAttestingRound
return nil
}
// SetEpochMetaBlockHash sets the epoch metaChain block hash
func (strV2 *ShardTriggerRegistryV2) SetEpochMetaBlockHash(epochMetaBlockHash []byte) error {
if strV2 == nil {
return data.ErrNilPointerReceiver
}
strV2.EpochMetaBlockHash = epochMetaBlockHash
return nil
}
// SetEpochStartHeaderHandler sets the epoch start header
func (strV2 *ShardTriggerRegistryV2) SetEpochStartHeaderHandler(epochStartHeaderHandler data.HeaderHandler) error {
if strV2 == nil {
return data.ErrNilPointerReceiver
}
var ok bool
strV2.EpochStartShardHeader, ok = epochStartHeaderHandler.(*HeaderV2)
if !ok {
return data.ErrInvalidTypeAssertion
}
return nil
}