diff options
author | obscuren <geffobscura@gmail.com> | 2015-03-04 00:20:34 +0800 |
---|---|---|
committer | obscuren <geffobscura@gmail.com> | 2015-03-04 00:20:34 +0800 |
commit | 22b132e28f74cabef38a55874da8e3db93786144 (patch) | |
tree | 2ae0e114e8aaf7dfba259c5e64979575bec4004b /core/block_processor.go | |
parent | ee0a1bec6c3ce942e51265535961ac6a745d33eb (diff) | |
parent | de9f79133faa1ff5dcd16fb4fd13d06b7799ded9 (diff) | |
download | go-tangerine-22b132e28f74cabef38a55874da8e3db93786144.tar go-tangerine-22b132e28f74cabef38a55874da8e3db93786144.tar.gz go-tangerine-22b132e28f74cabef38a55874da8e3db93786144.tar.bz2 go-tangerine-22b132e28f74cabef38a55874da8e3db93786144.tar.lz go-tangerine-22b132e28f74cabef38a55874da8e3db93786144.tar.xz go-tangerine-22b132e28f74cabef38a55874da8e3db93786144.tar.zst go-tangerine-22b132e28f74cabef38a55874da8e3db93786144.zip |
Merge branch 'publictests' of https://github.com/xcthulhu/go-ethereum into xcthulhu-publictests
Diffstat (limited to 'core/block_processor.go')
-rw-r--r-- | core/block_processor.go | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/core/block_processor.go b/core/block_processor.go index e48660a67..17256fe9c 100644 --- a/core/block_processor.go +++ b/core/block_processor.go @@ -7,12 +7,12 @@ import ( "sync" "time" + "github.com/ethereum/ethash" "github.com/ethereum/go-ethereum/core/types" "github.com/ethereum/go-ethereum/ethutil" "github.com/ethereum/go-ethereum/event" "github.com/ethereum/go-ethereum/logger" "github.com/ethereum/go-ethereum/pow" - "github.com/ethereum/go-ethereum/pow/ezp" "github.com/ethereum/go-ethereum/state" "gopkg.in/fatih/set.v0" ) @@ -50,7 +50,7 @@ func NewBlockProcessor(db ethutil.Database, txpool *TxPool, chainManager *ChainM sm := &BlockProcessor{ db: db, mem: make(map[string]*big.Int), - Pow: ezp.New(), + Pow: ethash.New(chainManager), bc: chainManager, eventMux: eventMux, txpool: txpool, @@ -105,6 +105,9 @@ func (self *BlockProcessor) ApplyTransaction(coinbase *state.StateObject, stated return receipt, txGas, err } +func (self *BlockProcessor) ChainManager() *ChainManager { + return self.bc +} func (self *BlockProcessor) ApplyTransactions(coinbase *state.StateObject, statedb *state.StateDB, block *types.Block, txs types.Transactions, transientProcess bool) (types.Receipts, types.Transactions, types.Transactions, types.Transactions, error) { var ( @@ -256,6 +259,11 @@ func (sm *BlockProcessor) ValidateBlock(block, parent *types.Block) error { return fmt.Errorf("GasLimit check failed for block %v", block.Header().GasLimit) } + // There can be at most one uncle + if len(block.Uncles()) > 1 { + return ValidationError("Block can only contain one uncle (contained %v)", len(block.Uncles())) + } + if block.Time() < parent.Time() { return ValidationError("Block timestamp not after prev block (%v - %v)", block.Header().Time, parent.Header().Time) } |