From df5603de0a34e80a1af6ad03e37ce43728baad35 Mon Sep 17 00:00:00 2001 From: obscuren Date: Thu, 30 Oct 2014 13:32:50 +0100 Subject: Moved logging to state, proper structured block * Moved logs to state so it's subject to snapshotting * Split up block header * Removed logs from transactions and made them receipts only --- ethstate/log.go | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 ethstate/log.go (limited to 'ethstate/log.go') diff --git a/ethstate/log.go b/ethstate/log.go new file mode 100644 index 000000000..a2e9ca041 --- /dev/null +++ b/ethstate/log.go @@ -0,0 +1,38 @@ +package ethstate + +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 +} -- cgit v1.2.3