@@ -91,22 +91,32 @@ class CBlockAverage
91
91
* Used as belt-and-suspenders check when reading to detect
92
92
* file corruption
93
93
*/
94
- bool AreSane (const std::vector<CFeeRate>& vecFee, const CFeeRate& minRelayFee)
94
+ static bool AreSane (const CFeeRate fee, const CFeeRate& minRelayFee)
95
+ {
96
+ if (fee < CFeeRate (0 ))
97
+ return false ;
98
+ if (fee.GetFeePerK () > minRelayFee.GetFeePerK () * 10000 )
99
+ return false ;
100
+ return true ;
101
+ }
102
+ static bool AreSane (const std::vector<CFeeRate>& vecFee, const CFeeRate& minRelayFee)
95
103
{
96
104
BOOST_FOREACH (CFeeRate fee, vecFee)
97
105
{
98
- if (fee < CFeeRate (0 ))
99
- return false ;
100
- if (fee.GetFeePerK () > minRelayFee.GetFeePerK () * 10000 )
106
+ if (!AreSane (fee, minRelayFee))
101
107
return false ;
102
108
}
103
109
return true ;
104
110
}
105
- bool AreSane (const std::vector<double > vecPriority)
111
+ static bool AreSane (const double priority)
112
+ {
113
+ return priority >= 0 ;
114
+ }
115
+ static bool AreSane (const std::vector<double > vecPriority)
106
116
{
107
117
BOOST_FOREACH (double priority, vecPriority)
108
118
{
109
- if (priority < 0 )
119
+ if (! AreSane ( priority) )
110
120
return false ;
111
121
}
112
122
return true ;
@@ -167,12 +177,12 @@ class CMinerPolicyEstimator
167
177
bool sufficientFee = (feeRate > minRelayFee);
168
178
bool sufficientPriority = AllowFree (dPriority);
169
179
const char * assignedTo = " unassigned" ;
170
- if (sufficientFee && !sufficientPriority)
180
+ if (sufficientFee && !sufficientPriority && CBlockAverage::AreSane (feeRate, minRelayFee) )
171
181
{
172
182
history[nBlocksTruncated].RecordFee (feeRate);
173
183
assignedTo = " fee" ;
174
184
}
175
- else if (sufficientPriority && !sufficientFee)
185
+ else if (sufficientPriority && !sufficientFee && CBlockAverage::AreSane (dPriority) )
176
186
{
177
187
history[nBlocksTruncated].RecordPriority (dPriority);
178
188
assignedTo = " priority" ;
0 commit comments