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