diff options
-rw-r--r-- | core/types/log.go | 8 | ||||
-rw-r--r-- | core/types/receipt.go | 8 |
2 files changed, 12 insertions, 4 deletions
diff --git a/core/types/log.go b/core/types/log.go index a395d5a67..864af5ef4 100644 --- a/core/types/log.go +++ b/core/types/log.go @@ -115,8 +115,12 @@ func (l *LogForStorage) EncodeRLP(w io.Writer) error { // // Note some redundant fields(e.g. block number, tx hash etc) will be assembled later. func (l *LogForStorage) DecodeRLP(s *rlp.Stream) error { + blob, err := s.Raw() + if err != nil { + return err + } var dec rlpStorageLog - err := s.Decode(&dec) + err = rlp.DecodeBytes(blob, &dec) if err == nil { *l = LogForStorage{ Address: dec.Address, @@ -126,7 +130,7 @@ func (l *LogForStorage) DecodeRLP(s *rlp.Stream) error { } else { // Try to decode log with previous definition. var dec LegacyRlpStorageLog - err = s.Decode(&dec) + err = rlp.DecodeBytes(blob, &dec) if err == nil { *l = LogForStorage{ Address: dec.Address, diff --git a/core/types/receipt.go b/core/types/receipt.go index ac1ebe349..0ba2f6e99 100644 --- a/core/types/receipt.go +++ b/core/types/receipt.go @@ -184,10 +184,14 @@ func (r *ReceiptForStorage) EncodeRLP(w io.Writer) error { // DecodeRLP implements rlp.Decoder, and loads both consensus and implementation // fields of a receipt from an RLP stream. func (r *ReceiptForStorage) DecodeRLP(s *rlp.Stream) error { + blob, err := s.Raw() + if err != nil { + return err + } var dec receiptStorageRLP - if err := s.Decode(&dec); err != nil { + if err := rlp.DecodeBytes(blob, &dec); err != nil { var sdec LegacyReceiptStorageRLP - if err := s.Decode(&sdec); err != nil { + if err := rlp.DecodeBytes(blob, &sdec); err != nil { return err } dec.PostStateOrStatus = common.CopyBytes(sdec.PostStateOrStatus) |