-
Notifications
You must be signed in to change notification settings - Fork 199
/
txLogsProcessorStub.go
49 lines (39 loc) · 1.16 KB
/
txLogsProcessorStub.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
package mock
import (
"github.com/multiversx/mx-chain-core-go/data"
vmcommon "github.com/multiversx/mx-chain-vm-common-go"
)
// TxLogsProcessorStub -
type TxLogsProcessorStub struct {
GetLogCalled func(txHash []byte) (data.LogHandler, error)
SaveLogCalled func(txHash []byte, tx data.TransactionHandler, vmLogs []*vmcommon.LogEntry) error
GetAllCurrentLogsCalled func() []*data.LogData
}
// GetLog -
func (txls *TxLogsProcessorStub) GetLog(txHash []byte) (data.LogHandler, error) {
if txls.GetLogCalled != nil {
return txls.GetLogCalled(txHash)
}
return nil, nil
}
// Clean -
func (txls *TxLogsProcessorStub) Clean() {
}
// SaveLog -
func (txls *TxLogsProcessorStub) SaveLog(txHash []byte, tx data.TransactionHandler, vmLogs []*vmcommon.LogEntry) error {
if txls.SaveLogCalled != nil {
return txls.SaveLogCalled(txHash, tx, vmLogs)
}
return nil
}
// GetAllCurrentLogs -
func (txls *TxLogsProcessorStub) GetAllCurrentLogs() []*data.LogData {
if txls.GetAllCurrentLogsCalled != nil {
return txls.GetAllCurrentLogsCalled()
}
return nil
}
// IsInterfaceNil -
func (txls *TxLogsProcessorStub) IsInterfaceNil() bool {
return txls == nil
}