-
Notifications
You must be signed in to change notification settings - Fork 199
/
whiteListHandlerStub.go
56 lines (47 loc) · 1.44 KB
/
whiteListHandlerStub.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
package testscommon
import "github.com/ElrondNetwork/elrond-go/process"
// WhiteListHandlerStub -
type WhiteListHandlerStub struct {
RemoveCalled func(keys [][]byte)
AddCalled func(keys [][]byte)
IsWhiteListedCalled func(interceptedData process.InterceptedData) bool
IsWhiteListedAtLeastOneCalled func(identifiers [][]byte) bool
IsForCurrentShardCalled func(interceptedData process.InterceptedData) bool
}
// IsWhiteListed -
func (w *WhiteListHandlerStub) IsWhiteListed(interceptedData process.InterceptedData) bool {
if w.IsWhiteListedCalled != nil {
return w.IsWhiteListedCalled(interceptedData)
}
return false
}
// IsWhiteListedAtLeastOne -
func (w *WhiteListHandlerStub) IsWhiteListedAtLeastOne(identifiers [][]byte) bool {
if w.IsWhiteListedAtLeastOneCalled != nil {
return w.IsWhiteListedAtLeastOneCalled(identifiers)
}
return false
}
// IsForCurrentShard -
func (w *WhiteListHandlerStub) IsForCurrentShard(interceptedData process.InterceptedData) bool {
if w.IsForCurrentShardCalled != nil {
return w.IsForCurrentShardCalled(interceptedData)
}
return true
}
// Remove -
func (w *WhiteListHandlerStub) Remove(keys [][]byte) {
if w.RemoveCalled != nil {
w.RemoveCalled(keys)
}
}
// Add -
func (w *WhiteListHandlerStub) Add(keys [][]byte) {
if w.AddCalled != nil {
w.AddCalled(keys)
}
}
// IsInterfaceNil -
func (w *WhiteListHandlerStub) IsInterfaceNil() bool {
return w == nil
}