-
Notifications
You must be signed in to change notification settings - Fork 199
/
epochStartTriggerStub.go
139 lines (117 loc) · 3.27 KB
/
epochStartTriggerStub.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
package testscommon
import (
"github.com/ElrondNetwork/elrond-go-core/core"
"github.com/ElrondNetwork/elrond-go-core/data"
)
// EpochStartTriggerStub -
type EpochStartTriggerStub struct {
ForceEpochStartCalled func(round uint64)
IsEpochStartCalled func() bool
EpochCalled func() uint32
MetaEpochCalled func() uint32
ReceivedHeaderCalled func(handler data.HeaderHandler)
UpdateCalled func(round uint64, nonce uint64)
ProcessedCalled func(header data.HeaderHandler)
EpochStartRoundCalled func() uint64
EpochFinalityAttestingRoundCalled func() uint64
EpochStartMetaHdrHashCalled func() []byte
}
// RevertStateToBlock -
func (e *EpochStartTriggerStub) RevertStateToBlock(_ data.HeaderHandler) error {
return nil
}
// RequestEpochStartIfNeeded -
func (e *EpochStartTriggerStub) RequestEpochStartIfNeeded(_ data.HeaderHandler) {
}
// SetCurrentEpochStartRound -
func (e *EpochStartTriggerStub) SetCurrentEpochStartRound(_ uint64) {
}
// NotifyAll -
func (e *EpochStartTriggerStub) NotifyAll(_ data.HeaderHandler) {
}
// SetFinalityAttestingRound -
func (e *EpochStartTriggerStub) SetFinalityAttestingRound(_ uint64) {
}
// EpochFinalityAttestingRound -
func (e *EpochStartTriggerStub) EpochFinalityAttestingRound() uint64 {
if e.EpochFinalityAttestingRoundCalled != nil {
return e.EpochFinalityAttestingRoundCalled()
}
return 0
}
// EpochStartMetaHdrHash -
func (e *EpochStartTriggerStub) EpochStartMetaHdrHash() []byte {
if e.EpochStartMetaHdrHashCalled != nil {
return e.EpochStartMetaHdrHashCalled()
}
return nil
}
// GetSavedStateKey -
func (e *EpochStartTriggerStub) GetSavedStateKey() []byte {
return []byte("epoch start trigger key")
}
// LoadState -
func (e *EpochStartTriggerStub) LoadState(_ []byte) error {
return nil
}
// SetAppStatusHandler -
func (e *EpochStartTriggerStub) SetAppStatusHandler(_ core.AppStatusHandler) error {
return nil
}
// Revert -
func (e *EpochStartTriggerStub) Revert(_ data.HeaderHandler) {
}
// EpochStartRound -
func (e *EpochStartTriggerStub) EpochStartRound() uint64 {
if e.EpochStartRoundCalled != nil {
return e.EpochStartRoundCalled()
}
return 0
}
// Update -
func (e *EpochStartTriggerStub) Update(round uint64, nonce uint64) {
if e.UpdateCalled != nil {
e.UpdateCalled(round, nonce)
}
}
// SetProcessed -
func (e *EpochStartTriggerStub) SetProcessed(header data.HeaderHandler, _ data.BodyHandler) {
if e.ProcessedCalled != nil {
e.ProcessedCalled(header)
}
}
// ForceEpochStart -
func (e *EpochStartTriggerStub) ForceEpochStart(round uint64) {
if e.ForceEpochStartCalled != nil {
e.ForceEpochStartCalled(round)
}
}
// IsEpochStart -
func (e *EpochStartTriggerStub) IsEpochStart() bool {
if e.IsEpochStartCalled != nil {
return e.IsEpochStartCalled()
}
return false
}
// Epoch -
func (e *EpochStartTriggerStub) Epoch() uint32 {
if e.EpochCalled != nil {
return e.EpochCalled()
}
return 0
}
// MetaEpoch -
func (e *EpochStartTriggerStub) MetaEpoch() uint32 {
if e.MetaEpochCalled != nil {
return e.MetaEpochCalled()
}
return 0
}
// Close -
func (e *EpochStartTriggerStub) Close() error {
return nil
}
// IsInterfaceNil -
func (e *EpochStartTriggerStub) IsInterfaceNil() bool {
return e == nil
}