-
Notifications
You must be signed in to change notification settings - Fork 15
/
trace.go
62 lines (54 loc) · 1.83 KB
/
trace.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
package types
import (
. "github.com/eosspark/eos-go/chain/types/generated_containers"
"github.com/eosspark/eos-go/common"
. "github.com/eosspark/eos-go/exception"
)
//go:generate gotemplate -outfmt "gen_%v" "github.com/eosspark/eos-go/common/container/treeset" AccountDeltaSet(AccountDelta,CompareAccountDelta,false)
type BaseActionTrace struct {
Receipt ActionReceipt
Act Action
ContextFree bool //default false
Elapsed common.Microseconds
CpuUsage uint64
Console string
TotalCpuUsage uint64 /// total of inline_traces[x].cpu_usage + cpu_usage
TrxId common.TransactionIdType ///< the transaction that generated this action
BlockNum uint32
BlockTime BlockTimeStamp
ProducerBlockId common.BlockIdType
AccountRamDeltas AccountDeltaSet
Except Exception
}
type ActionTrace struct {
BaseActionTrace
InlineTraces []ActionTrace
}
type TransactionTrace struct {
ID common.TransactionIdType
BlockNum uint32
BlockTime BlockTimeStamp
ProducerBlockId common.BlockIdType
Receipt TransactionReceiptHeader
Elapsed common.Microseconds
NetUsage uint64
Scheduled bool //false
ActionTraces []ActionTrace
FailedDtrxTrace *TransactionTrace
Except Exception
ExceptPtr Exception
}
func NewBaseActionTrace(ar *ActionReceipt) *BaseActionTrace {
bat := BaseActionTrace{}
bat.Receipt = *ar
bat.BlockNum = 0
bat.ContextFree = false
bat.TotalCpuUsage = 0
bat.CpuUsage = 0
return &bat
}
func (t TransactionTrace) IsEmpty() bool {
return t.ID.IsEmpty() && t.BlockNum == 0 && t.BlockTime == 0 && t.ProducerBlockId.IsEmpty() &&
t.Receipt.IsEmpty() && t.Elapsed == 0 && t.NetUsage == 0 && t.Scheduled && len(t.ActionTraces) == 0 &&
t.FailedDtrxTrace == nil && t.Except == nil && t.ExceptPtr == nil
}