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
1e24c2e4
Commit
1e24c2e4
authored
Jul 08, 2016
by
Péter Szilágyi
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
cmd/geth, miner, params: special extradata for DAO fork start
parent
9e56811a
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
22 additions
and
6 deletions
+22
-6
genesis_test.go
cmd/geth/genesis_test.go
+1
-0
worker.go
miner/worker.go
+9
-1
util.go
params/util.go
+12
-5
No files found.
cmd/geth/genesis_test.go
View file @
1e24c2e4
...
...
@@ -75,6 +75,7 @@ var customGenesisTests = []struct {
"timestamp" : "0x00",
"config" : {
"homesteadBlock" : 314,
"daoForkBlock" : 141
},
}`
,
query
:
"eth.getBlock(0).nonce"
,
...
...
miner/worker.go
View file @
1e24c2e4
...
...
@@ -33,6 +33,7 @@ import (
"github.com/ethereum/go-ethereum/event"
"github.com/ethereum/go-ethereum/logger"
"github.com/ethereum/go-ethereum/logger/glog"
"github.com/ethereum/go-ethereum/params"
"github.com/ethereum/go-ethereum/pow"
"gopkg.in/fatih/set.v0"
)
...
...
@@ -468,7 +469,14 @@ func (self *worker) commitNewWork() {
Extra
:
self
.
extra
,
Time
:
big
.
NewInt
(
tstamp
),
}
// If we are doing a DAO hard-fork check whether to override the extra-data or not
if
daoBlock
:=
self
.
config
.
DAOForkBlock
;
daoBlock
!=
nil
{
// Check whether the block is among the fork extra-override range
limit
:=
new
(
big
.
Int
)
.
Add
(
daoBlock
,
params
.
DAOForkExtraRange
)
if
daoBlock
.
Cmp
(
header
.
Number
)
<=
0
&&
header
.
Number
.
Cmp
(
limit
)
<
0
{
header
.
Extra
=
common
.
CopyBytes
(
params
.
DAOForkBlockExtra
)
}
}
previous
:=
self
.
current
// Could potentially happen if starting to mine in an odd state.
err
:=
self
.
makeCurrent
(
parent
,
header
)
...
...
params/util.go
View file @
1e24c2e4
...
...
@@ -16,11 +16,18 @@
package
params
import
"math/big"
import
(
"math/big"
"github.com/ethereum/go-ethereum/common"
)
var
(
TestNetHomesteadBlock
=
big
.
NewInt
(
494000
)
// testnet homestead block
MainNetHomesteadBlock
=
big
.
NewInt
(
1150000
)
// mainnet homestead block
TestNetDAOForkBlock
=
big
.
NewInt
(
8888888
)
// testnet dao hard-fork block
MainNetDAOForkBlock
=
big
.
NewInt
(
9999999
)
// mainnet dao hard-fork block
TestNetHomesteadBlock
=
big
.
NewInt
(
494000
)
// Testnet homestead block
MainNetHomesteadBlock
=
big
.
NewInt
(
1150000
)
// Mainnet homestead block
TestNetDAOForkBlock
=
big
.
NewInt
(
8888888
)
// Testnet dao hard-fork block
MainNetDAOForkBlock
=
big
.
NewInt
(
9999999
)
// Mainnet dao hard-fork block
DAOForkBlockExtra
=
common
.
FromHex
(
"0x64616f2d686172642d666f726b"
)
// Block extradata to signel the fork with ("dao-hard-fork")
DAOForkExtraRange
=
big
.
NewInt
(
10
)
// Number of blocks to override the extradata (prevent no-fork attacks)
)
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