core: differentiate receipt concensus and storage decoding

This commit is contained in:
Péter Szilágyi
2015-09-29 19:36:16 +03:00
parent b99fe27f8b
commit 42c8afd440
9 changed files with 113 additions and 80 deletions

View File

@ -140,12 +140,16 @@ func GetBlockReceipts(db ethdb.Database, hash common.Hash) types.Receipts {
if len(data) == 0 {
return nil
}
receipts := new(types.Receipts)
if err := rlp.DecodeBytes(data, receipts); err != nil {
rs := []*types.ReceiptForStorage{}
if err := rlp.DecodeBytes(data, &rs); err != nil {
glog.V(logger.Error).Infof("invalid receipt array RLP for hash %x: %v", hash, err)
return nil
}
return *receipts
receipts := make(types.Receipts, len(rs))
for i, receipt := range rs {
receipts[i] = (*types.Receipt)(receipt)
}
return receipts
}
// PutBlockReceipts stores the block's transactions associated receipts