core, miner: write miner receipts

pull/1681/head
Jeffrey Wilcke 9 years ago
parent 2497f28aa9
commit b4369e1015
  1. 8
      core/block_processor.go
  2. 4
      core/chain_manager.go
  3. 4
      core/filter.go
  4. 7
      miner/worker.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
}

@ -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++
}

@ -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
}

@ -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

Loading…
Cancel
Save