Revert "core/types: implement log.EncodeRLP"

This reverts commit fe8bf2df9e.

Signed-off-by: jsvisa <delweng@gmail.com>
This commit is contained in:
jsvisa 2023-08-26 22:01:24 +08:00
parent fe8bf2df9e
commit 72fb873bd8

View file

@ -17,13 +17,13 @@
package types package types
import ( import (
"io"
"github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/common/hexutil" "github.com/ethereum/go-ethereum/common/hexutil"
"github.com/ethereum/go-ethereum/rlp"
) )
//go:generate go run ../../rlp/rlpgen -type Log -out gen_log_rlp.go
//go:generate go run github.com/fjl/gencodec -type Log -field-override logMarshaling -out gen_log_json.go
// Log represents a contract log event. These events are generated by the LOG opcode and // Log represents a contract log event. These events are generated by the LOG opcode and
// stored/indexed by the node. // stored/indexed by the node.
type Log struct { type Log struct {
@ -53,23 +53,6 @@ type Log struct {
Removed bool `json:"removed" rlp:"-"` Removed bool `json:"removed" rlp:"-"`
} }
// EncodeRLP implements rlp.Encoder, and flattens all content fields of a log
// into an RLP stream.
func (log *Log) EncodeRLP(_w io.Writer) error {
w := rlp.NewEncoderBuffer(_w)
outerList := w.List()
w.WriteBytes(log.Address[:])
topicList := w.List()
for _, topic := range log.Topics {
w.WriteBytes(topic[:])
}
w.ListEnd(topicList)
w.WriteBytes(log.Data)
w.ListEnd(outerList)
return w.Flush()
}
//go:generate go run github.com/fjl/gencodec -type Log -field-override logMarshaling -out gen_log_json.go
type logMarshaling struct { type logMarshaling struct {
Data hexutil.Bytes Data hexutil.Bytes
BlockNumber hexutil.Uint64 BlockNumber hexutil.Uint64