aboutsummaryrefslogtreecommitdiffstats
path: root/core/block_processor.go
diff options
context:
space:
mode:
authorobscuren <geffobscura@gmail.com>2015-03-19 23:59:13 +0800
committerobscuren <geffobscura@gmail.com>2015-03-19 23:59:13 +0800
commitb5a71d955cacec0c8f81fbcf36b6f3d6d60b4bb1 (patch)
tree9d94b69006029e91d7cdf2d0eb9d6d457d238671 /core/block_processor.go
parentce063e8d9c2d26dd283a43b097903628225179ea (diff)
parente540a75030de611ca8cf0a70621421b6aa3fbebf (diff)
downloadgo-tangerine-b5a71d955cacec0c8f81fbcf36b6f3d6d60b4bb1.tar
go-tangerine-b5a71d955cacec0c8f81fbcf36b6f3d6d60b4bb1.tar.gz
go-tangerine-b5a71d955cacec0c8f81fbcf36b6f3d6d60b4bb1.tar.bz2
go-tangerine-b5a71d955cacec0c8f81fbcf36b6f3d6d60b4bb1.tar.lz
go-tangerine-b5a71d955cacec0c8f81fbcf36b6f3d6d60b4bb1.tar.xz
go-tangerine-b5a71d955cacec0c8f81fbcf36b6f3d6d60b4bb1.tar.zst
go-tangerine-b5a71d955cacec0c8f81fbcf36b6f3d6d60b4bb1.zip
merge
Diffstat (limited to 'core/block_processor.go')
-rw-r--r--core/block_processor.go18
1 files changed, 7 insertions, 11 deletions
diff --git a/core/block_processor.go b/core/block_processor.go
index b12f88c47..99c5fea05 100644
--- a/core/block_processor.go
+++ b/core/block_processor.go
@@ -16,10 +16,6 @@ import (
"gopkg.in/fatih/set.v0"
)
-type PendingBlockEvent struct {
- Block *types.Block
-}
-
var statelogger = logger.NewLogger("BLOCK")
type BlockProcessor struct {
@@ -137,7 +133,7 @@ func (self *BlockProcessor) ApplyTransactions(coinbase *state.StateObject, state
block.Header().GasUsed = totalUsedGas
if transientProcess {
- go self.eventMux.Post(PendingBlockEvent{block})
+ go self.eventMux.Post(PendingBlockEvent{block, statedb.Logs()})
}
return receipts, handled, unhandled, erroneous, err
@@ -146,25 +142,25 @@ func (self *BlockProcessor) ApplyTransactions(coinbase *state.StateObject, state
// Process block will attempt to process the given block's transactions and applies them
// on top of the block's parent state (given it exists) and will return wether it was
// successful or not.
-func (sm *BlockProcessor) Process(block *types.Block) (td *big.Int, err error) {
+func (sm *BlockProcessor) Process(block *types.Block) (td *big.Int, logs state.Logs, err error) {
// Processing a blocks may never happen simultaneously
sm.mutex.Lock()
defer sm.mutex.Unlock()
header := block.Header()
if sm.bc.HasBlock(header.Hash()) {
- return nil, &KnownBlockError{header.Number, header.Hash()}
+ return nil, nil, &KnownBlockError{header.Number, header.Hash()}
}
if !sm.bc.HasBlock(header.ParentHash) {
- return nil, ParentError(header.ParentHash)
+ return nil, nil, ParentError(header.ParentHash)
}
parent := sm.bc.GetBlock(header.ParentHash)
return sm.processWithParent(block, parent)
}
-func (sm *BlockProcessor) processWithParent(block, parent *types.Block) (td *big.Int, err error) {
+func (sm *BlockProcessor) processWithParent(block, parent *types.Block) (td *big.Int, logs state.Logs, err error) {
sm.lastAttemptedBlock = block
// Create a new state based on the parent's root (e.g., create copy)
@@ -177,7 +173,7 @@ func (sm *BlockProcessor) processWithParent(block, parent *types.Block) (td *big
// There can be at most two uncles
if len(block.Uncles()) > 2 {
- return nil, ValidationError("Block can only contain one uncle (contained %v)", len(block.Uncles()))
+ return nil, nil, ValidationError("Block can only contain one uncle (contained %v)", len(block.Uncles()))
}
receipts, err := sm.TransitionState(state, parent, block, false)
@@ -236,7 +232,7 @@ func (sm *BlockProcessor) processWithParent(block, parent *types.Block) (td *big
chainlogger.Infof("processed block #%d (%x...)\n", header.Number, block.Hash().Bytes()[0:4])
- return td, nil
+ return td, state.Logs(), nil
}
// Validates the current block. Returns an error if the block was invalid,