core, core/vm: added structure logging
This also reduces the time required spend in the VM
This commit is contained in:
@ -16,6 +16,8 @@ type VMEnv struct {
|
||||
depth int
|
||||
chain *ChainManager
|
||||
typ vm.Type
|
||||
// structured logging
|
||||
logs []vm.StructLog
|
||||
}
|
||||
|
||||
func NewEnv(state *state.StateDB, chain *ChainManager, msg Message, block *types.Block) *VMEnv {
|
||||
@ -47,6 +49,7 @@ func (self *VMEnv) GetHash(n uint64) common.Hash {
|
||||
|
||||
return common.Hash{}
|
||||
}
|
||||
|
||||
func (self *VMEnv) AddLog(log *state.Log) {
|
||||
self.state.AddLog(log)
|
||||
}
|
||||
@ -68,3 +71,11 @@ func (self *VMEnv) Create(me vm.ContextRef, data []byte, gas, price, value *big.
|
||||
exe := NewExecution(self, nil, data, gas, price, value)
|
||||
return exe.Create(me)
|
||||
}
|
||||
|
||||
func (self *VMEnv) StructLogs() []vm.StructLog {
|
||||
return self.logs
|
||||
}
|
||||
|
||||
func (self *VMEnv) AddStructLog(log vm.StructLog) {
|
||||
self.logs = append(self.logs, log)
|
||||
}
|
||||
|
Reference in New Issue
Block a user