diff options
author | Péter Szilágyi <peterke@gmail.com> | 2019-02-28 20:15:52 +0800 |
---|---|---|
committer | Péter Szilágyi <peterke@gmail.com> | 2019-02-28 20:16:36 +0800 |
commit | 1bc7f3f90606ea01f51babb9c87384684f87d4a8 (patch) | |
tree | ab532e9c75a4d2652976e17701e7a4bc387b9e02 | |
parent | dac7cbcf21a601ef889aa56c59d22c3a3776099e (diff) | |
download | go-tangerine-1bc7f3f90606ea01f51babb9c87384684f87d4a8.tar go-tangerine-1bc7f3f90606ea01f51babb9c87384684f87d4a8.tar.gz go-tangerine-1bc7f3f90606ea01f51babb9c87384684f87d4a8.tar.bz2 go-tangerine-1bc7f3f90606ea01f51babb9c87384684f87d4a8.tar.lz go-tangerine-1bc7f3f90606ea01f51babb9c87384684f87d4a8.tar.xz go-tangerine-1bc7f3f90606ea01f51babb9c87384684f87d4a8.tar.zst go-tangerine-1bc7f3f90606ea01f51babb9c87384684f87d4a8.zip |
core/types: fix receipt legacy decoding
-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) |