aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJeffrey Wilcke <geffobscura@gmail.com>2015-08-19 03:16:33 +0800
committerJeffrey Wilcke <geffobscura@gmail.com>2015-08-19 03:46:26 +0800
commitb4369e10150f4c1211ae1bf2de6cf0567e9a7dd2 (patch)
tree9fdbbe9ff489253506059f2b4f48ac451d3d401e
parent2497f28aa9d74f84468055fbc4675f379b7e4a5a (diff)
downloadgo-tangerine-b4369e10150f4c1211ae1bf2de6cf0567e9a7dd2.tar.gz
go-tangerine-b4369e10150f4c1211ae1bf2de6cf0567e9a7dd2.tar.zst
go-tangerine-b4369e10150f4c1211ae1bf2de6cf0567e9a7dd2.zip
core, miner: write miner receipts
-rw-r--r--core/block_processor.go8
-rw-r--r--core/chain_manager.go4
-rw-r--r--core/filter.go4
-rw-r--r--miner/worker.go7
4 files changed, 14 insertions, 9 deletions
diff --git a/core/block_processor.go b/core/block_processor.go
index 829e4314c..dd7fe8962 100644
--- a/core/block_processor.go
+++ b/core/block_processor.go
@@ -349,11 +349,9 @@ func (sm *BlockProcessor) GetBlockReceipts(bhash common.Hash) types.Receipts {
// the depricated way by re-processing the block.
func (sm *BlockProcessor) GetLogs(block *types.Block) (logs state.Logs, err error) {
receipts := GetBlockReceipts(sm.chainDb, block.Hash())
- if len(receipts) > 0 {
- // coalesce logs
- for _, receipt := range receipts {
- logs = append(logs, receipt.Logs()...)
- }
+ // coalesce logs
+ for _, receipt := range receipts {
+ logs = append(logs, receipt.Logs()...)
}
return logs, nil
}
diff --git a/core/chain_manager.go b/core/chain_manager.go
index 1647031b1..cf5b8bd78 100644
--- a/core/chain_manager.go
+++ b/core/chain_manager.go
@@ -647,7 +647,9 @@ func (self *ChainManager) InsertChain(chain types.Blocks) (int, error) {
queue[i] = ChainSplitEvent{block, logs}
queueEvent.splitCount++
}
- PutBlockReceipts(self.chainDb, block, receipts)
+ if err := PutBlockReceipts(self.chainDb, block, receipts); err != nil {
+ glog.V(logger.Warn).Infoln("error writing block receipts:", err)
+ }
stats.processed++
}
diff --git a/core/filter.go b/core/filter.go
index 8a876396b..c34d6ff6c 100644
--- a/core/filter.go
+++ b/core/filter.go
@@ -22,6 +22,8 @@ import (
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/core/state"
"github.com/ethereum/go-ethereum/core/types"
+ "github.com/ethereum/go-ethereum/logger"
+ "github.com/ethereum/go-ethereum/logger/glog"
)
type AccountChange struct {
@@ -111,7 +113,7 @@ done:
// Get the logs of the block
unfiltered, err := self.eth.BlockProcessor().GetLogs(block)
if err != nil {
- chainlogger.Warnln("err: filter get logs ", err)
+ glog.V(logger.Warn).Infoln("err: filter get logs ", err)
break
}
diff --git a/miner/worker.go b/miner/worker.go
index df3681470..aa2132a51 100644
--- a/miner/worker.go
+++ b/miner/worker.go
@@ -297,14 +297,17 @@ func (self *worker) wait() {
}
// broadcast before waiting for validation
- go func(block *types.Block, logs state.Logs) {
+ go func(block *types.Block, logs state.Logs, receipts []*types.Receipt) {
self.mux.Post(core.NewMinedBlockEvent{block})
self.mux.Post(core.ChainEvent{block, block.Hash(), logs})
if stat == core.CanonStatTy {
self.mux.Post(core.ChainHeadEvent{block})
self.mux.Post(logs)
}
- }(block, work.state.Logs())
+ if err := core.PutBlockReceipts(self.chainDb, block, receipts); err != nil {
+ glog.V(logger.Warn).Infoln("error writing block receipts:", err)
+ }
+ }(block, work.state.Logs(), work.receipts)
}
// check staleness and display confirmation