aboutsummaryrefslogtreecommitdiffstats
path: root/core
diff options
context:
space:
mode:
authorobscuren <geffobscura@gmail.com>2015-01-22 07:24:30 +0800
committerobscuren <geffobscura@gmail.com>2015-01-22 07:24:30 +0800
commit0045ce4cde69af0dd4b2f77871f893b091250489 (patch)
tree63f31f96c899af2a4b4de94455cf5428188de21a /core
parent465b0a79d8fa2550e6104d0d86e357b123f74a39 (diff)
downloaddexon-0045ce4cde69af0dd4b2f77871f893b091250489.tar
dexon-0045ce4cde69af0dd4b2f77871f893b091250489.tar.gz
dexon-0045ce4cde69af0dd4b2f77871f893b091250489.tar.bz2
dexon-0045ce4cde69af0dd4b2f77871f893b091250489.tar.lz
dexon-0045ce4cde69af0dd4b2f77871f893b091250489.tar.xz
dexon-0045ce4cde69af0dd4b2f77871f893b091250489.tar.zst
dexon-0045ce4cde69af0dd4b2f77871f893b091250489.zip
Future blocks not allowed
Diffstat (limited to 'core')
-rw-r--r--core/block_processor.go25
1 files changed, 4 insertions, 21 deletions
diff --git a/core/block_processor.go b/core/block_processor.go
index aa8fcc9e7..37acc4f72 100644
--- a/core/block_processor.go
+++ b/core/block_processor.go
@@ -5,6 +5,7 @@ import (
"fmt"
"math/big"
"sync"
+ "time"
"github.com/ethereum/go-ethereum/core/types"
"github.com/ethereum/go-ethereum/crypto"
@@ -251,15 +252,12 @@ func (sm *BlockProcessor) ValidateBlock(block, parent *types.Block) error {
return ValidationError("Block timestamp less then prev block %v (%v - %v)", diff, block.Header().Time, sm.bc.CurrentBlock().Header().Time)
}
- /* XXX
- // New blocks must be within the 15 minute range of the last block.
- if diff > int64(15*time.Minute) {
- return ValidationError("Block is too far in the future of last block (> 15 minutes)")
+ if block.Time() > time.Now().Unix() {
+ return fmt.Errorf("block time is in the future")
}
- */
// Verify the nonce of the block. Return an error if it's not valid
- if !sm.Pow.Verify(block /*block.HashNoNonce(), block.Difficulty, block.Nonce*/) {
+ if !sm.Pow.Verify(block) {
return ValidationError("Block's nonce is invalid (= %v)", ethutil.Bytes2Hex(block.Header().Nonce))
}
@@ -287,21 +285,6 @@ func (sm *BlockProcessor) AccumelateRewards(statedb *state.StateDB, block, paren
return UncleError(fmt.Sprintf("Uncle's parent unknown (%x)", uncle.ParentHash[0:4]))
}
- /*
- uncleParent := sm.bc.GetBlock(uncle.ParentHash)
- if uncleParent == nil {
- return UncleError(fmt.Sprintf("Uncle's parent unknown (%x)", uncle.ParentHash[0:4]))
- }
-
- if uncleParent.Number().Cmp(new(big.Int).Sub(parent.Number(), big.NewInt(6))) < 0 {
- return UncleError("Uncle too old")
- }
-
- if knownUncles.Has(string(uncle.Hash())) {
- return UncleError("Uncle in chain")
- }
- */
-
r := new(big.Int)
r.Mul(BlockReward, big.NewInt(15)).Div(r, big.NewInt(16))