From 3f94d09c1f07538c3fc72c72609037c47c04c4b5 Mon Sep 17 00:00:00 2001 From: zsfelfoldi Date: Tue, 26 May 2015 14:17:43 +0200 Subject: fixed saving receipts --- core/block_processor.go | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) (limited to 'core') diff --git a/core/block_processor.go b/core/block_processor.go index 54378b2b9..0ed30ca21 100644 --- a/core/block_processor.go +++ b/core/block_processor.go @@ -260,9 +260,31 @@ func (sm *BlockProcessor) processWithParent(block, parent *types.Block) (logs st putTx(sm.extraDb, tx, block, uint64(i)) } + receiptsRlp := receipts.RlpEncode() + /*if len(receipts) > 0 { + glog.V(logger.Info).Infof("Saving %v receipts, rlp len is %v\n", len(receipts), len(receiptsRlp)) + }*/ + sm.extraDb.Put(append(receiptsPre, block.Hash().Bytes()...), receiptsRlp) + return state.Logs(), nil } +func (self *BlockProcessor) GetBlockReceipts(bhash common.Hash) (receipts types.Receipts, err error) { + var rdata []byte + rdata, err = self.extraDb.Get(append(receiptsPre, bhash[:]...)) + + if err == nil { + err = rlp.DecodeBytes(rdata, &receipts) + } else { + glog.V(logger.Detail).Infof("GetBlockReceipts error %v\n", err) + } + /*if len(receipts) > 0 { + glog.V(logger.Info).Infof("GBR len %v\n", len(receipts)) + }*/ + return + +} + // See YP section 4.3.4. "Block Header Validity" // Validates a block. Returns an error if the block is invalid. func (sm *BlockProcessor) ValidateHeader(block, parent *types.Header, checkPow bool) error { -- cgit v1.2.3