diff options
author | obscuren <geffobscura@gmail.com> | 2014-10-31 21:43:14 +0800 |
---|---|---|
committer | obscuren <geffobscura@gmail.com> | 2014-10-31 21:43:14 +0800 |
commit | af8f5f0b69f1c359991d12c7708804fe8dd1f944 (patch) | |
tree | dd3d5bea8d57037a2d32fae86c4ba7fcc9161b16 /state/log.go | |
parent | 0ed1a8b50a9b9726cd57a2731d0405f6949c6188 (diff) | |
download | go-tangerine-af8f5f0b69f1c359991d12c7708804fe8dd1f944.tar go-tangerine-af8f5f0b69f1c359991d12c7708804fe8dd1f944.tar.gz go-tangerine-af8f5f0b69f1c359991d12c7708804fe8dd1f944.tar.bz2 go-tangerine-af8f5f0b69f1c359991d12c7708804fe8dd1f944.tar.lz go-tangerine-af8f5f0b69f1c359991d12c7708804fe8dd1f944.tar.xz go-tangerine-af8f5f0b69f1c359991d12c7708804fe8dd1f944.tar.zst go-tangerine-af8f5f0b69f1c359991d12c7708804fe8dd1f944.zip |
ethstate => state
Diffstat (limited to 'state/log.go')
-rw-r--r-- | state/log.go | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/state/log.go b/state/log.go new file mode 100644 index 000000000..73039d7ce --- /dev/null +++ b/state/log.go @@ -0,0 +1,38 @@ +package state + +import "github.com/ethereum/go-ethereum/ethutil" + +type Log struct { + Address []byte + Topics [][]byte + Data []byte +} + +func NewLogFromValue(decoder *ethutil.Value) Log { + log := Log{ + Address: decoder.Get(0).Bytes(), + Data: decoder.Get(2).Bytes(), + } + + it := decoder.Get(1).NewIterator() + for it.Next() { + log.Topics = append(log.Topics, it.Value().Bytes()) + } + + return log +} + +func (self Log) RlpData() interface{} { + return []interface{}{self.Address, ethutil.ByteSliceToInterface(self.Topics), self.Data} +} + +type Logs []Log + +func (self Logs) RlpData() interface{} { + data := make([]interface{}, len(self)) + for i, log := range self { + data[i] = log.RlpData() + } + + return data +} |