diff options
author | obscuren <geffobscura@gmail.com> | 2015-06-10 03:12:25 +0800 |
---|---|---|
committer | obscuren <geffobscura@gmail.com> | 2015-06-10 03:12:25 +0800 |
commit | bac9a94ddf20dc530966cbf6cd384aaf94aedc77 (patch) | |
tree | 0ced967e60315698cc5056a984d7678c417bc1ce /core/block_processor.go | |
parent | 0e703d92ac9df61e2ededa8c895c70ded101a607 (diff) | |
parent | 14994fa21bf6f05554ff370d41005d06b68d20a5 (diff) | |
download | go-tangerine-0.9.28.tar go-tangerine-0.9.28.tar.gz go-tangerine-0.9.28.tar.bz2 go-tangerine-0.9.28.tar.lz go-tangerine-0.9.28.tar.xz go-tangerine-0.9.28.tar.zst go-tangerine-0.9.28.zip |
Merge branch 'release/0.9.28'v0.9.28
Diffstat (limited to 'core/block_processor.go')
-rw-r--r-- | core/block_processor.go | 15 |
1 files changed, 3 insertions, 12 deletions
diff --git a/core/block_processor.go b/core/block_processor.go index ca205ee86..190e72694 100644 --- a/core/block_processor.go +++ b/core/block_processor.go @@ -38,14 +38,12 @@ type BlockProcessor struct { // Proof of work used for validating Pow pow.PoW - txpool *TxPool - events event.Subscription eventMux *event.TypeMux } -func NewBlockProcessor(db, extra common.Database, pow pow.PoW, txpool *TxPool, chainManager *ChainManager, eventMux *event.TypeMux) *BlockProcessor { +func NewBlockProcessor(db, extra common.Database, pow pow.PoW, chainManager *ChainManager, eventMux *event.TypeMux) *BlockProcessor { sm := &BlockProcessor{ db: db, extraDb: extra, @@ -53,7 +51,6 @@ func NewBlockProcessor(db, extra common.Database, pow pow.PoW, txpool *TxPool, c Pow: pow, bc: chainManager, eventMux: eventMux, - txpool: txpool, } return sm @@ -178,7 +175,6 @@ func (sm *BlockProcessor) Process(block *types.Block) (logs state.Logs, err erro return nil, ParentError(header.ParentHash) } parent := sm.bc.GetBlock(header.ParentHash) - return sm.processWithParent(block, parent) } @@ -254,14 +250,9 @@ func (sm *BlockProcessor) processWithParent(block, parent *types.Block) (logs st return nil, err } - // Calculate the td for this block - //td = CalculateTD(block, parent) // Sync the current block's state to the database state.Sync() - // Remove transactions from the pool - sm.txpool.RemoveTransactions(block.Transactions()) - // This puts transactions in a extra db for rpc for i, tx := range block.Transactions() { putTx(sm.extraDb, tx, block, uint64(i)) @@ -364,8 +355,8 @@ func (sm *BlockProcessor) VerifyUncles(statedb *state.StateDB, block, parent *ty return UncleError("uncle[%d](%x) is ancestor", i, hash[:4]) } - if !ancestors.Has(uncle.ParentHash) { - return UncleError("uncle[%d](%x)'s parent unknown (%x)", i, hash[:4], uncle.ParentHash[0:4]) + if !ancestors.Has(uncle.ParentHash) || uncle.ParentHash == parent.Hash() { + return UncleError("uncle[%d](%x)'s parent is not ancestor (%x)", i, hash[:4], uncle.ParentHash[0:4]) } if err := sm.ValidateHeader(uncle, ancestorHeaders[uncle.ParentHash], true); err != nil { |