diff options
author | Gustav Simonsson <gustav.simonsson@gmail.com> | 2015-02-04 06:09:39 +0800 |
---|---|---|
committer | Gustav Simonsson <gustav.simonsson@gmail.com> | 2015-02-04 06:09:39 +0800 |
commit | 697c2b5dc16653228c5264d01c08163cebda3aeb (patch) | |
tree | b66a5e52908c5ab571bfaa97fb47525dd572f6f0 | |
parent | 4dc283c0fb5d886ce8d3638c3322af7e6f2a3b2e (diff) | |
download | dexon-697c2b5dc16653228c5264d01c08163cebda3aeb.tar.gz dexon-697c2b5dc16653228c5264d01c08163cebda3aeb.tar.zst dexon-697c2b5dc16653228c5264d01c08163cebda3aeb.zip |
Correct block parent timestamp check and typos
-rw-r--r-- | core/block_processor.go | 12 | ||||
-rw-r--r-- | miner/miner.go | 2 |
2 files changed, 7 insertions, 7 deletions
diff --git a/core/block_processor.go b/core/block_processor.go index 4d5cd94c9..60d73e390 100644 --- a/core/block_processor.go +++ b/core/block_processor.go @@ -206,7 +206,7 @@ func (sm *BlockProcessor) ProcessWithParent(block, parent *types.Block) (td *big return } - if err = sm.AccumelateRewards(state, block, parent); err != nil { + if err = sm.AccumulateRewards(state, block, parent); err != nil { return } @@ -248,8 +248,8 @@ func (sm *BlockProcessor) ValidateBlock(block, parent *types.Block) error { } diff := block.Header().Time - parent.Header().Time - if diff < 0 { - return ValidationError("Block timestamp less then prev block %v (%v - %v)", diff, block.Header().Time, sm.bc.CurrentBlock().Header().Time) + if diff <= 0 { + return ValidationError("Block timestamp not after prev block %v (%v - %v)", diff, block.Header().Time, sm.bc.CurrentBlock().Header().Time) } if block.Time() > time.Now().Unix() { @@ -264,7 +264,7 @@ func (sm *BlockProcessor) ValidateBlock(block, parent *types.Block) error { return nil } -func (sm *BlockProcessor) AccumelateRewards(statedb *state.StateDB, block, parent *types.Block) error { +func (sm *BlockProcessor) AccumulateRewards(statedb *state.StateDB, block, parent *types.Block) error { reward := new(big.Int).Set(BlockReward) ancestors := set.New() @@ -326,7 +326,7 @@ func (sm *BlockProcessor) GetMessages(block *types.Block) (messages []*state.Mes defer state.Reset() sm.TransitionState(state, parent, block) - sm.AccumelateRewards(state, block, parent) + sm.AccumulateRewards(state, block, parent) return state.Manifest().Messages, nil } @@ -347,7 +347,7 @@ func (sm *BlockProcessor) GetLogs(block *types.Block) (logs state.Logs, err erro defer state.Reset() sm.TransitionState(state, parent, block) - sm.AccumelateRewards(state, block, parent) + sm.AccumulateRewards(state, block, parent) return state.Logs(), nil } diff --git a/miner/miner.go b/miner/miner.go index 52dd5687d..7ebf00d6a 100644 --- a/miner/miner.go +++ b/miner/miner.go @@ -206,7 +206,7 @@ func (self *Miner) mine() { block.SetReceipts(receipts) // Accumulate the rewards included for this block - blockProcessor.AccumelateRewards(state, block, parent) + blockProcessor.AccumulateRewards(state, block, parent) state.Update(ethutil.Big0) block.SetRoot(state.Root()) |