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
e282246a
Unverified
Commit
e282246a
authored
Jan 27, 2022
by
Sina Mahmoodi
Committed by
GitHub
Jan 27, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
cmd/utils: open db in readonly when dev datadir exists (#24298)
parent
015fde9a
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
1 deletion
+7
-1
flags.go
cmd/utils/flags.go
+7
-1
No files found.
cmd/utils/flags.go
View file @
e282246a
...
...
@@ -1673,9 +1673,15 @@ func SetEthConfig(ctx *cli.Context, stack *node.Node, cfg *ethconfig.Config) {
// Create a new developer genesis block or reuse existing one
cfg
.
Genesis
=
core
.
DeveloperGenesisBlock
(
uint64
(
ctx
.
GlobalInt
(
DeveloperPeriodFlag
.
Name
)),
ctx
.
GlobalUint64
(
DeveloperGasLimitFlag
.
Name
),
developer
.
Address
)
if
ctx
.
GlobalIsSet
(
DataDirFlag
.
Name
)
{
// If datadir doesn't exist we need to open db in write-mode
// so leveldb can create files.
readonly
:=
true
if
!
common
.
FileExist
(
stack
.
ResolvePath
(
"chaindata"
))
{
readonly
=
false
}
// Check if we have an already initialized chain and fall back to
// that if so. Otherwise we need to generate a new genesis spec.
chaindb
:=
MakeChainDatabase
(
ctx
,
stack
,
false
)
chaindb
:=
MakeChainDatabase
(
ctx
,
stack
,
readonly
)
if
rawdb
.
ReadCanonicalHash
(
chaindb
,
0
)
!=
(
common
.
Hash
{})
{
cfg
.
Genesis
=
nil
// fallback to db content
}
...
...
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