@@ -87,8 +87,7 @@ func NewOracle(backend OracleBackend, params Config) *Oracle {
87
87
if percent < 0 {
88
88
percent = 0
89
89
log .Warn ("Sanitizing invalid gasprice oracle sample percentile" , "provided" , params .Percentile , "updated" , percent )
90
- }
91
- if percent > 100 {
90
+ } else if percent > 100 {
92
91
percent = 100
93
92
log .Warn ("Sanitizing invalid gasprice oracle sample percentile" , "provided" , params .Percentile , "updated" , percent )
94
93
}
@@ -104,6 +103,16 @@ func NewOracle(backend OracleBackend, params Config) *Oracle {
104
103
} else if ignorePrice .Int64 () > 0 {
105
104
log .Info ("Gasprice oracle is ignoring threshold set" , "threshold" , ignorePrice )
106
105
}
106
+ maxHeaderHistory := params .MaxHeaderHistory
107
+ if maxHeaderHistory < 1 {
108
+ maxHeaderHistory = 1
109
+ log .Warn ("Sanitizing invalid gasprice oracle max header history" , "provided" , params .MaxHeaderHistory , "updated" , maxHeaderHistory )
110
+ }
111
+ maxBlockHistory := params .MaxBlockHistory
112
+ if maxBlockHistory < 1 {
113
+ maxBlockHistory = 1
114
+ log .Warn ("Sanitizing invalid gasprice oracle max block history" , "provided" , params .MaxBlockHistory , "updated" , maxBlockHistory )
115
+ }
107
116
108
117
cache , _ := lru .New (2048 )
109
118
headEvent := make (chan core.ChainHeadEvent , 1 )
@@ -125,8 +134,8 @@ func NewOracle(backend OracleBackend, params Config) *Oracle {
125
134
ignorePrice : ignorePrice ,
126
135
checkBlocks : blocks ,
127
136
percentile : percent ,
128
- maxHeaderHistory : params . MaxHeaderHistory ,
129
- maxBlockHistory : params . MaxBlockHistory ,
137
+ maxHeaderHistory : maxHeaderHistory ,
138
+ maxBlockHistory : maxBlockHistory ,
130
139
historyCache : cache ,
131
140
}
132
141
}
0 commit comments