mirror of https://github.com/ethereum/go-ethereum
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
39 lines
704 B
39 lines
704 B
10 years ago
|
package state
|
||
10 years ago
|
|
||
10 years ago
|
import "github.com/ethereum/go-ethereum/ethutil"
|
||
10 years ago
|
|
||
|
type Log struct {
|
||
|
Address []byte
|
||
10 years ago
|
Topics [][]byte
|
||
10 years ago
|
Data []byte
|
||
|
}
|
||
10 years ago
|
|
||
|
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
|
||
|
}
|