aboutsummaryrefslogtreecommitdiffstats
path: root/core
diff options
context:
space:
mode:
authorzsfelfoldi <zsfelfoldi@gmail.com>2015-05-26 20:17:43 +0800
committerzsfelfoldi <zsfelfoldi@gmail.com>2015-06-15 21:55:38 +0800
commit3f94d09c1f07538c3fc72c72609037c47c04c4b5 (patch)
tree22013e951e7af5e42fa0ded9835b68ea4d1370d9 /core
parent6f5c6150b7060b6b2ee68ac95b30f46c5c2c7f90 (diff)
downloaddexon-3f94d09c1f07538c3fc72c72609037c47c04c4b5.tar
dexon-3f94d09c1f07538c3fc72c72609037c47c04c4b5.tar.gz
dexon-3f94d09c1f07538c3fc72c72609037c47c04c4b5.tar.bz2
dexon-3f94d09c1f07538c3fc72c72609037c47c04c4b5.tar.lz
dexon-3f94d09c1f07538c3fc72c72609037c47c04c4b5.tar.xz
dexon-3f94d09c1f07538c3fc72c72609037c47c04c4b5.tar.zst
dexon-3f94d09c1f07538c3fc72c72609037c47c04c4b5.zip
fixed saving receipts
Diffstat (limited to 'core')
-rw-r--r--core/block_processor.go22
1 files changed, 22 insertions, 0 deletions
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 {