Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
G
Geth-Modification
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
张蕾
Geth-Modification
Commits
0045ce4c
Commit
0045ce4c
authored
Jan 21, 2015
by
obscuren
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Future blocks not allowed
parent
465b0a79
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
21 deletions
+4
-21
block_processor.go
core/block_processor.go
+4
-21
No files found.
core/block_processor.go
View file @
0045ce4c
...
@@ -5,6 +5,7 @@ import (
...
@@ -5,6 +5,7 @@ import (
"fmt"
"fmt"
"math/big"
"math/big"
"sync"
"sync"
"time"
"github.com/ethereum/go-ethereum/core/types"
"github.com/ethereum/go-ethereum/core/types"
"github.com/ethereum/go-ethereum/crypto"
"github.com/ethereum/go-ethereum/crypto"
...
@@ -251,15 +252,12 @@ func (sm *BlockProcessor) ValidateBlock(block, parent *types.Block) error {
...
@@ -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
)
return
ValidationError
(
"Block timestamp less then prev block %v (%v - %v)"
,
diff
,
block
.
Header
()
.
Time
,
sm
.
bc
.
CurrentBlock
()
.
Header
()
.
Time
)
}
}
/* XXX
if
block
.
Time
()
>
time
.
Now
()
.
Unix
()
{
// New blocks must be within the 15 minute range of the last block.
return
fmt
.
Errorf
(
"block time is in the future"
)
if diff > int64(15*time.Minute) {
return ValidationError("Block is too far in the future of last block (> 15 minutes)")
}
}
*/
// Verify the nonce of the block. Return an error if it's not valid
// 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
))
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
...
@@ -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
]))
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
:=
new
(
big
.
Int
)
r
.
Mul
(
BlockReward
,
big
.
NewInt
(
15
))
.
Div
(
r
,
big
.
NewInt
(
16
))
r
.
Mul
(
BlockReward
,
big
.
NewInt
(
15
))
.
Div
(
r
,
big
.
NewInt
(
16
))
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment