-
Notifications
You must be signed in to change notification settings - Fork 202
/
printTxLogProcessor.go
70 lines (56 loc) · 1.59 KB
/
printTxLogProcessor.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
package transactionLog
import (
"encoding/hex"
"strings"
"github.com/multiversx/mx-chain-core-go/data"
vmcommon "github.com/multiversx/mx-chain-vm-common-go"
)
type printTxLogProcessor struct {
}
// NewPrintTxLogProcessor -
func NewPrintTxLogProcessor() *printTxLogProcessor {
return &printTxLogProcessor{}
}
// GetLog -
func (tlp *printTxLogProcessor) GetLog(_ []byte) (data.LogHandler, error) {
return nil, nil
}
// GetLogFromCache -
func (tlp *printTxLogProcessor) GetLogFromCache(_ []byte) (*data.LogData, bool) {
return &data.LogData{}, false
}
// EnableLogToBeSavedInCache -
func (tlp *printTxLogProcessor) EnableLogToBeSavedInCache() {
}
// Clean -
func (tlp *printTxLogProcessor) Clean() {
}
// GetAllCurrentLogs -
func (tlp *printTxLogProcessor) GetAllCurrentLogs() []*data.LogData {
return []*data.LogData{}
}
// SaveLog -
func (tlp *printTxLogProcessor) SaveLog(txHash []byte, _ data.TransactionHandler, logEntries []*vmcommon.LogEntry) error {
if len(logEntries) == 0 {
return nil
}
log.Debug("printTxLogProcessor.SaveLog", "transaction hash", hex.EncodeToString(txHash))
for _, entry := range logEntries {
log.Debug("printTxLogProcessor.entry",
"identifier", string(entry.Identifier),
"address", entry.Address,
"topics", prepareTopics(entry.Topics))
}
return nil
}
func prepareTopics(topics [][]byte) string {
all := ""
for _, topic := range topics {
all = strings.Join([]string{all, string(topic)}, " ")
}
return all
}
// IsInterfaceNil returns true if there is no value under the interface
func (tlp *printTxLogProcessor) IsInterfaceNil() bool {
return tlp == nil
}