core, core/vm: added structure logging

This also reduces the time required spend in the VM
This commit is contained in:
obscuren
2015-06-10 12:23:49 +02:00
parent ff5b3ef087
commit 38c61f6f25
9 changed files with 104 additions and 149 deletions

View File

@ -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)
}