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
c52def7f
Unverified
Commit
c52def7f
authored
Nov 18, 2021
by
courtier
Committed by
GitHub
Nov 18, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
eth/gasprice: sanitize max header and block history (#23886)
Fixes #23452
parent
16341e05
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
4 deletions
+13
-4
gasprice.go
eth/gasprice/gasprice.go
+13
-4
No files found.
eth/gasprice/gasprice.go
View file @
c52def7f
...
@@ -87,8 +87,7 @@ func NewOracle(backend OracleBackend, params Config) *Oracle {
...
@@ -87,8 +87,7 @@ func NewOracle(backend OracleBackend, params Config) *Oracle {
if
percent
<
0
{
if
percent
<
0
{
percent
=
0
percent
=
0
log
.
Warn
(
"Sanitizing invalid gasprice oracle sample percentile"
,
"provided"
,
params
.
Percentile
,
"updated"
,
percent
)
log
.
Warn
(
"Sanitizing invalid gasprice oracle sample percentile"
,
"provided"
,
params
.
Percentile
,
"updated"
,
percent
)
}
}
else
if
percent
>
100
{
if
percent
>
100
{
percent
=
100
percent
=
100
log
.
Warn
(
"Sanitizing invalid gasprice oracle sample percentile"
,
"provided"
,
params
.
Percentile
,
"updated"
,
percent
)
log
.
Warn
(
"Sanitizing invalid gasprice oracle sample percentile"
,
"provided"
,
params
.
Percentile
,
"updated"
,
percent
)
}
}
...
@@ -104,6 +103,16 @@ func NewOracle(backend OracleBackend, params Config) *Oracle {
...
@@ -104,6 +103,16 @@ func NewOracle(backend OracleBackend, params Config) *Oracle {
}
else
if
ignorePrice
.
Int64
()
>
0
{
}
else
if
ignorePrice
.
Int64
()
>
0
{
log
.
Info
(
"Gasprice oracle is ignoring threshold set"
,
"threshold"
,
ignorePrice
)
log
.
Info
(
"Gasprice oracle is ignoring threshold set"
,
"threshold"
,
ignorePrice
)
}
}
maxHeaderHistory
:=
params
.
MaxHeaderHistory
if
maxHeaderHistory
<
1
{
maxHeaderHistory
=
1
log
.
Warn
(
"Sanitizing invalid gasprice oracle max header history"
,
"provided"
,
params
.
MaxHeaderHistory
,
"updated"
,
maxHeaderHistory
)
}
maxBlockHistory
:=
params
.
MaxBlockHistory
if
maxBlockHistory
<
1
{
maxBlockHistory
=
1
log
.
Warn
(
"Sanitizing invalid gasprice oracle max block history"
,
"provided"
,
params
.
MaxBlockHistory
,
"updated"
,
maxBlockHistory
)
}
cache
,
_
:=
lru
.
New
(
2048
)
cache
,
_
:=
lru
.
New
(
2048
)
headEvent
:=
make
(
chan
core
.
ChainHeadEvent
,
1
)
headEvent
:=
make
(
chan
core
.
ChainHeadEvent
,
1
)
...
@@ -125,8 +134,8 @@ func NewOracle(backend OracleBackend, params Config) *Oracle {
...
@@ -125,8 +134,8 @@ func NewOracle(backend OracleBackend, params Config) *Oracle {
ignorePrice
:
ignorePrice
,
ignorePrice
:
ignorePrice
,
checkBlocks
:
blocks
,
checkBlocks
:
blocks
,
percentile
:
percent
,
percentile
:
percent
,
maxHeaderHistory
:
params
.
M
axHeaderHistory
,
maxHeaderHistory
:
m
axHeaderHistory
,
maxBlockHistory
:
params
.
M
axBlockHistory
,
maxBlockHistory
:
m
axBlockHistory
,
historyCache
:
cache
,
historyCache
:
cache
,
}
}
}
}
...
...
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