-
Notifications
You must be signed in to change notification settings - Fork 199
/
check.go
66 lines (61 loc) · 1.88 KB
/
check.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
package blockAPI
import (
"errors"
"github.com/multiversx/mx-chain-core-go/core/check"
"github.com/multiversx/mx-chain-go/process"
)
var (
errNilArgAPIBlockProcessor = errors.New("nil arg api block processor")
errNilTransactionHandler = errors.New("nil API transaction handler")
errNilLogsFacade = errors.New("nil logs facade")
errNilReceiptsRepository = errors.New("nil receipts repository")
errNilAlteredAccountsProvider = errors.New("nil altered accounts provider")
errNilAccountsRepository = errors.New("nil accounts repository")
errNilScheduledTxsExecutionHandler = errors.New("nil scheduled txs execution handler")
errNilEnableEpochsHandler = errors.New("nil enable epochs handler")
)
func checkNilArg(arg *ArgAPIBlockProcessor) error {
if arg == nil {
return errNilArgAPIBlockProcessor
}
if check.IfNil(arg.Uint64ByteSliceConverter) {
return process.ErrNilUint64Converter
}
if check.IfNil(arg.Store) {
return process.ErrNilStorage
}
if check.IfNil(arg.Marshalizer) {
return process.ErrNilMarshalizer
}
if check.IfNil(arg.HistoryRepo) {
return process.ErrNilHistoryRepository
}
if check.IfNil(arg.APITransactionHandler) {
return errNilTransactionHandler
}
if check.IfNil(arg.Hasher) {
return process.ErrNilHasher
}
if check.IfNil(arg.AddressPubkeyConverter) {
return process.ErrNilPubkeyConverter
}
if check.IfNil(arg.LogsFacade) {
return errNilLogsFacade
}
if check.IfNil(arg.ReceiptsRepository) {
return errNilReceiptsRepository
}
if check.IfNil(arg.AlteredAccountsProvider) {
return errNilAlteredAccountsProvider
}
if check.IfNil(arg.AccountsRepository) {
return errNilAccountsRepository
}
if check.IfNil(arg.ScheduledTxsExecutionHandler) {
return errNilScheduledTxsExecutionHandler
}
if check.IfNil(arg.EnableEpochsHandler) {
return errNilEnableEpochsHandler
}
return nil
}