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
40818684
Commit
40818684
authored
9 years ago
by
Bas van Kervel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
cmd/utils: bugfix where database is opened multiple times
parent
7e021056
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
7 deletions
+11
-7
flags.go
cmd/utils/flags.go
+11
-7
No files found.
cmd/utils/flags.go
View file @
40818684
...
...
@@ -776,16 +776,20 @@ func SetupNetwork(ctx *cli.Context) {
params
.
TargetGasLimit
=
common
.
String2Big
(
ctx
.
GlobalString
(
TargetGasLimitFlag
.
Name
))
}
// MustMakeChainConfig reads the chain configuration from the
given database
.
// MustMakeChainConfig reads the chain configuration from the
database in ctx.Datadir
.
func
MustMakeChainConfig
(
ctx
*
cli
.
Context
)
*
core
.
ChainConfig
{
var
(
db
=
MakeChainDatabase
(
ctx
)
genesis
=
core
.
GetBlock
(
db
,
core
.
GetCanonicalHash
(
db
,
0
))
)
db
:=
MakeChainDatabase
(
ctx
)
defer
db
.
Close
()
return
MustMakeChainConfigFromDb
(
ctx
,
db
)
}
// MustMakeChainConfigFromDb reads the chain configuration from the given database.
func
MustMakeChainConfigFromDb
(
ctx
*
cli
.
Context
,
db
ethdb
.
Database
)
*
core
.
ChainConfig
{
genesis
:=
core
.
GetBlock
(
db
,
core
.
GetCanonicalHash
(
db
,
0
))
if
genesis
!=
nil
{
// Exsting genesis block, use stored config if available.
// Ex
i
sting genesis block, use stored config if available.
storedConfig
,
err
:=
core
.
GetChainConfig
(
db
,
genesis
.
Hash
())
if
err
==
nil
{
return
storedConfig
...
...
@@ -829,7 +833,7 @@ func MakeChain(ctx *cli.Context) (chain *core.BlockChain, chainDb ethdb.Database
}
}
chainConfig
:=
MustMakeChainConfig
(
ctx
)
chainConfig
:=
MustMakeChainConfig
FromDb
(
ctx
,
chainDb
)
var
eventMux
event
.
TypeMux
chain
,
err
=
core
.
NewBlockChain
(
chainDb
,
chainConfig
,
ethash
.
New
(),
&
eventMux
)
...
...
This diff is collapsed.
Click to expand it.
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