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
2c50b2c9
Commit
2c50b2c9
authored
Aug 15, 2019
by
gary rong
Committed by
Felix Lange
Aug 15, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
cmd/geth: set up cache and metrics when starting node (#19911)
parent
9bad7fa7
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
46 additions
and
40 deletions
+46
-40
consolecmd.go
cmd/geth/consolecmd.go
+1
-0
main.go
cmd/geth/main.go
+45
-40
No files found.
cmd/geth/consolecmd.go
View file @
2c50b2c9
...
...
@@ -77,6 +77,7 @@ JavaScript API. See https://github.com/ethereum/go-ethereum/wiki/JavaScript-Cons
// same time.
func
localConsole
(
ctx
*
cli
.
Context
)
error
{
// Create and start the node based on the CLI flags
prepare
(
ctx
)
node
:=
makeFullNode
(
ctx
)
startNode
(
ctx
,
node
)
defer
node
.
Close
()
...
...
cmd/geth/main.go
View file @
2c50b2c9
...
...
@@ -242,6 +242,26 @@ func init() {
if
err
:=
debug
.
Setup
(
ctx
,
logdir
);
err
!=
nil
{
return
err
}
return
nil
}
app
.
After
=
func
(
ctx
*
cli
.
Context
)
error
{
debug
.
Exit
()
console
.
Stdin
.
Close
()
// Resets terminal mode.
return
nil
}
}
func
main
()
{
if
err
:=
app
.
Run
(
os
.
Args
);
err
!=
nil
{
fmt
.
Fprintln
(
os
.
Stderr
,
err
)
os
.
Exit
(
1
)
}
}
// prepare manipulates memory cache allowance and setups metric system.
// This function should be called before launching devp2p stack.
func
prepare
(
ctx
*
cli
.
Context
)
{
// If we're a full node on mainnet without --cache specified, bump default cache allowance
if
ctx
.
GlobalString
(
utils
.
SyncModeFlag
.
Name
)
!=
"light"
&&
!
ctx
.
GlobalIsSet
(
utils
.
CacheFlag
.
Name
)
&&
!
ctx
.
GlobalIsSet
(
utils
.
NetworkIdFlag
.
Name
)
{
// Make sure we're not on any supported preconfigured testnet either
...
...
@@ -281,22 +301,6 @@ func init() {
// Start system runtime metrics collection
go
metrics
.
CollectProcessMetrics
(
3
*
time
.
Second
)
return
nil
}
app
.
After
=
func
(
ctx
*
cli
.
Context
)
error
{
debug
.
Exit
()
console
.
Stdin
.
Close
()
// Resets terminal mode.
return
nil
}
}
func
main
()
{
if
err
:=
app
.
Run
(
os
.
Args
);
err
!=
nil
{
fmt
.
Fprintln
(
os
.
Stderr
,
err
)
os
.
Exit
(
1
)
}
}
// geth is the main entry point into the system if no special subcommand is ran.
...
...
@@ -306,6 +310,7 @@ func geth(ctx *cli.Context) error {
if
args
:=
ctx
.
Args
();
len
(
args
)
>
0
{
return
fmt
.
Errorf
(
"invalid command: %q"
,
args
[
0
])
}
prepare
(
ctx
)
node
:=
makeFullNode
(
ctx
)
defer
node
.
Close
()
startNode
(
ctx
,
node
)
...
...
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