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
2547c9c9
Commit
2547c9c9
authored
Oct 07, 2015
by
Péter Szilágyi
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
cmd: properly initialize Olympic for all subcommands
parent
27528ad3
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
17 additions
and
17 deletions
+17
-17
main.go
cmd/geth/main.go
+1
-3
cmd.go
cmd/utils/cmd.go
+0
-13
flags.go
cmd/utils/flags.go
+16
-1
No files found.
cmd/geth/main.go
View file @
2547c9c9
...
...
@@ -340,6 +340,7 @@ JavaScript API. See https://github.com/ethereum/go-ethereum/wiki/Javascipt-Conso
}
app
.
Before
=
func
(
ctx
*
cli
.
Context
)
error
{
utils
.
SetupLogger
(
ctx
)
utils
.
SetupNetwork
(
ctx
)
utils
.
SetupVM
(
ctx
)
utils
.
SetupEth
(
ctx
)
if
ctx
.
GlobalBool
(
utils
.
PProfEanbledFlag
.
Name
)
{
...
...
@@ -391,9 +392,6 @@ func makeDefaultExtra() []byte {
func
run
(
ctx
*
cli
.
Context
)
{
utils
.
CheckLegalese
(
utils
.
MustDataDir
(
ctx
))
if
ctx
.
GlobalBool
(
utils
.
OlympicFlag
.
Name
)
{
utils
.
InitOlympic
()
}
cfg
:=
utils
.
MakeEthConfig
(
ClientIdentifier
,
nodeNameVersion
,
ctx
)
cfg
.
ExtraData
=
makeExtra
(
ctx
)
...
...
cmd/utils/cmd.go
View file @
2547c9c9
...
...
@@ -21,8 +21,6 @@ import (
"bufio"
"fmt"
"io"
"math"
"math/big"
"os"
"os/signal"
"regexp"
...
...
@@ -34,7 +32,6 @@ import (
"github.com/ethereum/go-ethereum/eth"
"github.com/ethereum/go-ethereum/logger"
"github.com/ethereum/go-ethereum/logger/glog"
"github.com/ethereum/go-ethereum/params"
"github.com/ethereum/go-ethereum/rlp"
"github.com/peterh/liner"
)
...
...
@@ -146,16 +143,6 @@ func StartEthereum(ethereum *eth.Ethereum) {
}()
}
func
InitOlympic
()
{
params
.
DurationLimit
=
big
.
NewInt
(
8
)
params
.
GenesisGasLimit
=
big
.
NewInt
(
3141592
)
params
.
MinGasLimit
=
big
.
NewInt
(
125000
)
params
.
MaximumExtraDataSize
=
big
.
NewInt
(
1024
)
NetworkIdFlag
.
Value
=
0
core
.
BlockReward
=
big
.
NewInt
(
1.5e+18
)
core
.
ExpDiffPeriod
=
big
.
NewInt
(
math
.
MaxInt64
)
}
func
FormatTransactionData
(
data
string
)
[]
byte
{
d
:=
common
.
StringToByteFunc
(
data
,
func
(
s
string
)
(
ret
[]
byte
)
{
slice
:=
regexp
.
MustCompile
(
"
\\
n|
\\
s"
)
.
Split
(
s
,
1000000000
)
...
...
cmd/utils/flags.go
View file @
2547c9c9
...
...
@@ -20,6 +20,7 @@ import (
"crypto/ecdsa"
"fmt"
"log"
"math"
"math/big"
"net"
"net/http"
...
...
@@ -42,6 +43,7 @@ import (
"github.com/ethereum/go-ethereum/logger/glog"
"github.com/ethereum/go-ethereum/metrics"
"github.com/ethereum/go-ethereum/p2p/nat"
"github.com/ethereum/go-ethereum/params"
"github.com/ethereum/go-ethereum/rpc/api"
"github.com/ethereum/go-ethereum/rpc/codec"
"github.com/ethereum/go-ethereum/rpc/comms"
...
...
@@ -488,6 +490,20 @@ func SetupLogger(ctx *cli.Context) {
glog
.
SetLogDir
(
ctx
.
GlobalString
(
LogFileFlag
.
Name
))
}
// SetupNetwork configures the system for either the main net or some test network.
func
SetupNetwork
(
ctx
*
cli
.
Context
)
{
switch
{
case
ctx
.
GlobalBool
(
OlympicFlag
.
Name
)
:
params
.
DurationLimit
=
big
.
NewInt
(
8
)
params
.
GenesisGasLimit
=
big
.
NewInt
(
3141592
)
params
.
MinGasLimit
=
big
.
NewInt
(
125000
)
params
.
MaximumExtraDataSize
=
big
.
NewInt
(
1024
)
NetworkIdFlag
.
Value
=
0
core
.
BlockReward
=
big
.
NewInt
(
1.5e+18
)
core
.
ExpDiffPeriod
=
big
.
NewInt
(
math
.
MaxInt64
)
}
}
// SetupVM configured the VM package's global settings
func
SetupVM
(
ctx
*
cli
.
Context
)
{
vm
.
EnableJit
=
ctx
.
GlobalBool
(
VMEnableJitFlag
.
Name
)
...
...
@@ -517,7 +533,6 @@ func MakeChain(ctx *cli.Context) (chain *core.BlockChain, chainDb ethdb.Database
Fatalf
(
"Could not open database: %v"
,
err
)
}
if
ctx
.
GlobalBool
(
OlympicFlag
.
Name
)
{
InitOlympic
()
_
,
err
:=
core
.
WriteTestNetGenesisBlock
(
chainDb
,
42
)
if
err
!=
nil
{
glog
.
Fatalln
(
err
)
...
...
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