|
5 | 5 | "fmt" |
6 | 6 | "math/big" |
7 | 7 | "sync" |
| 8 | + "time" |
8 | 9 |
|
9 | 10 | "github.com/ethereum/go-ethereum/core/types" |
10 | 11 | "github.com/ethereum/go-ethereum/crypto" |
@@ -251,15 +252,12 @@ func (sm *BlockProcessor) ValidateBlock(block, parent *types.Block) error { |
251 | 252 | return ValidationError("Block timestamp less then prev block %v (%v - %v)", diff, block.Header().Time, sm.bc.CurrentBlock().Header().Time) |
252 | 253 | } |
253 | 254 |
|
254 | | - /* XXX |
255 | | - // New blocks must be within the 15 minute range of the last block. |
256 | | - if diff > int64(15*time.Minute) { |
257 | | - return ValidationError("Block is too far in the future of last block (> 15 minutes)") |
| 255 | + if block.Time() > time.Now().Unix() { |
| 256 | + return fmt.Errorf("block time is in the future") |
258 | 257 | } |
259 | | - */ |
260 | 258 |
|
261 | 259 | // Verify the nonce of the block. Return an error if it's not valid |
262 | | - if !sm.Pow.Verify(block /*block.HashNoNonce(), block.Difficulty, block.Nonce*/) { |
| 260 | + if !sm.Pow.Verify(block) { |
263 | 261 | return ValidationError("Block's nonce is invalid (= %v)", ethutil.Bytes2Hex(block.Header().Nonce)) |
264 | 262 | } |
265 | 263 |
|
@@ -287,21 +285,6 @@ func (sm *BlockProcessor) AccumelateRewards(statedb *state.StateDB, block, paren |
287 | 285 | return UncleError(fmt.Sprintf("Uncle's parent unknown (%x)", uncle.ParentHash[0:4])) |
288 | 286 | } |
289 | 287 |
|
290 | | - /* |
291 | | - uncleParent := sm.bc.GetBlock(uncle.ParentHash) |
292 | | - if uncleParent == nil { |
293 | | - return UncleError(fmt.Sprintf("Uncle's parent unknown (%x)", uncle.ParentHash[0:4])) |
294 | | - } |
295 | | -
|
296 | | - if uncleParent.Number().Cmp(new(big.Int).Sub(parent.Number(), big.NewInt(6))) < 0 { |
297 | | - return UncleError("Uncle too old") |
298 | | - } |
299 | | -
|
300 | | - if knownUncles.Has(string(uncle.Hash())) { |
301 | | - return UncleError("Uncle in chain") |
302 | | - } |
303 | | - */ |
304 | | - |
305 | 288 | r := new(big.Int) |
306 | 289 | r.Mul(BlockReward, big.NewInt(15)).Div(r, big.NewInt(16)) |
307 | 290 |
|
|
0 commit comments