Decode full receipt storage

This commit is contained in:
Taylor Gerring 2015-07-04 00:00:23 -05:00 committed by zelig
parent 45b4443f3f
commit 89bf9c71bd
3 changed files with 18 additions and 3 deletions

View file

@ -54,6 +54,21 @@ func PutReceipts(db common.Database, receipts types.Receipts) error {
return nil
}
// GetReceipt returns a receipt by hash
func GetFullReceipt(db common.Database, txHash common.Hash) *types.ReceiptForStorage {
data, _ := db.Get(append(receiptsPre, txHash[:]...))
if len(data) == 0 {
return nil
}
var receipt types.ReceiptForStorage
err := rlp.DecodeBytes(data, &receipt)
if err != nil {
glog.V(logger.Error).Infoln("GetReceipt err:", err)
}
return &receipt
}
// GetReceipt returns a receipt by hash
func GetReceipt(db common.Database, txHash common.Hash) *types.Receipt {
data, _ := db.Get(append(receiptsPre, txHash[:]...))

View file

@ -414,7 +414,7 @@ type ReceiptRes struct {
Logs *[]interface{} `json:"logs"`
}
func NewReceiptRes(rec *types.Receipt) *ReceiptRes {
func NewReceiptRes(rec *types.ReceiptForStorage) *ReceiptRes {
if rec == nil {
return nil
}

View file

@ -340,8 +340,8 @@ func (self *XEth) GetBlockReceipts(bhash common.Hash) types.Receipts {
return self.backend.BlockProcessor().GetBlockReceipts(bhash)
}
func (self *XEth) GetTxReceipt(txhash common.Hash) *types.Receipt {
return core.GetReceipt(self.backend.ExtraDb(), txhash)
func (self *XEth) GetTxReceipt(txhash common.Hash) *types.ReceiptForStorage {
return core.GetFullReceipt(self.backend.ExtraDb(), txhash)
}
func (self *XEth) GasLimit() *big.Int {