diff options
author | Jeffrey Wilcke <jeffrey@ethereum.org> | 2015-10-17 03:35:24 +0800 |
---|---|---|
committer | Jeffrey Wilcke <jeffrey@ethereum.org> | 2015-10-17 03:35:24 +0800 |
commit | 10ed107ba2001d1aabba3d319ba88c5ce6e8fdc0 (patch) | |
tree | 7c79e36cadcc57a8c936f06838a061cdf7e3fd8a /core/blockchain.go | |
parent | c5ef2afda56c069fda5528c48bd3d831b81455dc (diff) | |
parent | 6dc14788a238f3e0ec786c6c04d476a3b957e645 (diff) | |
download | go-tangerine-10ed107ba2001d1aabba3d319ba88c5ce6e8fdc0.tar go-tangerine-10ed107ba2001d1aabba3d319ba88c5ce6e8fdc0.tar.gz go-tangerine-10ed107ba2001d1aabba3d319ba88c5ce6e8fdc0.tar.bz2 go-tangerine-10ed107ba2001d1aabba3d319ba88c5ce6e8fdc0.tar.lz go-tangerine-10ed107ba2001d1aabba3d319ba88c5ce6e8fdc0.tar.xz go-tangerine-10ed107ba2001d1aabba3d319ba88c5ce6e8fdc0.tar.zst go-tangerine-10ed107ba2001d1aabba3d319ba88c5ce6e8fdc0.zip |
Merge pull request #1899 from obscuren/mipmap-bloom
core, eth/filters, miner, xeth: Optimised log filtering
Diffstat (limited to 'core/blockchain.go')
-rw-r--r-- | core/blockchain.go | 27 |
1 files changed, 22 insertions, 5 deletions
diff --git a/core/blockchain.go b/core/blockchain.go index 62a306265..7bfe13a11 100644 --- a/core/blockchain.go +++ b/core/blockchain.go @@ -654,10 +654,17 @@ func (self *BlockChain) InsertChain(chain types.Blocks) (int, error) { events = append(events, ChainEvent{block, block.Hash(), logs}) // This puts transactions in a extra db for rpc - PutTransactions(self.chainDb, block, block.Transactions()) + if err := PutTransactions(self.chainDb, block, block.Transactions()); err != nil { + return i, err + } // store the receipts - PutReceipts(self.chainDb, receipts) - + if err := PutReceipts(self.chainDb, receipts); err != nil { + return i, err + } + // Write map map bloom filters + if err := WriteMipmapBloom(self.chainDb, block.NumberU64(), receipts); err != nil { + return i, err + } case SideStatTy: if glog.V(logger.Detail) { glog.Infof("inserted forked block #%d (TD=%v) (%d TXs %d UNCs) (%x...). Took %v\n", block.Number(), block.Difficulty(), len(block.Transactions()), len(block.Uncles()), block.Hash().Bytes()[0:4], time.Since(bstart)) @@ -743,8 +750,18 @@ func (self *BlockChain) reorg(oldBlock, newBlock *types.Block) error { // insert the block in the canonical way, re-writing history self.insert(block) // write canonical receipts and transactions - PutTransactions(self.chainDb, block, block.Transactions()) - PutReceipts(self.chainDb, GetBlockReceipts(self.chainDb, block.Hash())) + if err := PutTransactions(self.chainDb, block, block.Transactions()); err != nil { + return err + } + receipts := GetBlockReceipts(self.chainDb, block.Hash()) + // write receipts + if err := PutReceipts(self.chainDb, receipts); err != nil { + return err + } + // Write map map bloom filters + if err := WriteMipmapBloom(self.chainDb, block.NumberU64(), receipts); err != nil { + return err + } addedTxs = append(addedTxs, block.Transactions()...) } |