|
|
@ -91,22 +91,32 @@ public: |
|
|
|
* Used as belt-and-suspenders check when reading to detect |
|
|
|
* Used as belt-and-suspenders check when reading to detect |
|
|
|
* file corruption |
|
|
|
* file corruption |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
bool AreSane(const std::vector<CFeeRate>& vecFee, const CFeeRate& minRelayFee) |
|
|
|
static bool AreSane(const CFeeRate fee, const CFeeRate& minRelayFee) |
|
|
|
{ |
|
|
|
|
|
|
|
BOOST_FOREACH(CFeeRate fee, vecFee) |
|
|
|
|
|
|
|
{ |
|
|
|
{ |
|
|
|
if (fee < CFeeRate(0)) |
|
|
|
if (fee < CFeeRate(0)) |
|
|
|
return false; |
|
|
|
return false; |
|
|
|
if (fee.GetFeePerK() > minRelayFee.GetFeePerK() * 10000) |
|
|
|
if (fee.GetFeePerK() > minRelayFee.GetFeePerK() * 10000) |
|
|
|
return false; |
|
|
|
return false; |
|
|
|
|
|
|
|
return true; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
static bool AreSane(const std::vector<CFeeRate>& vecFee, const CFeeRate& minRelayFee) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
BOOST_FOREACH(CFeeRate fee, vecFee) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
if (!AreSane(fee, minRelayFee)) |
|
|
|
|
|
|
|
return false; |
|
|
|
} |
|
|
|
} |
|
|
|
return true; |
|
|
|
return true; |
|
|
|
} |
|
|
|
} |
|
|
|
bool AreSane(const std::vector<double> vecPriority) |
|
|
|
static bool AreSane(const double priority) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
return priority >= 0; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
static bool AreSane(const std::vector<double> vecPriority) |
|
|
|
{ |
|
|
|
{ |
|
|
|
BOOST_FOREACH(double priority, vecPriority) |
|
|
|
BOOST_FOREACH(double priority, vecPriority) |
|
|
|
{ |
|
|
|
{ |
|
|
|
if (priority < 0) |
|
|
|
if (!AreSane(priority)) |
|
|
|
return false; |
|
|
|
return false; |
|
|
|
} |
|
|
|
} |
|
|
|
return true; |
|
|
|
return true; |
|
|
@ -167,12 +177,12 @@ private: |
|
|
|
bool sufficientFee = (feeRate > minRelayFee); |
|
|
|
bool sufficientFee = (feeRate > minRelayFee); |
|
|
|
bool sufficientPriority = AllowFree(dPriority); |
|
|
|
bool sufficientPriority = AllowFree(dPriority); |
|
|
|
const char* assignedTo = "unassigned"; |
|
|
|
const char* assignedTo = "unassigned"; |
|
|
|
if (sufficientFee && !sufficientPriority) |
|
|
|
if (sufficientFee && !sufficientPriority && CBlockAverage::AreSane(feeRate, minRelayFee)) |
|
|
|
{ |
|
|
|
{ |
|
|
|
history[nBlocksTruncated].RecordFee(feeRate); |
|
|
|
history[nBlocksTruncated].RecordFee(feeRate); |
|
|
|
assignedTo = "fee"; |
|
|
|
assignedTo = "fee"; |
|
|
|
} |
|
|
|
} |
|
|
|
else if (sufficientPriority && !sufficientFee) |
|
|
|
else if (sufficientPriority && !sufficientFee && CBlockAverage::AreSane(dPriority)) |
|
|
|
{ |
|
|
|
{ |
|
|
|
history[nBlocksTruncated].RecordPriority(dPriority); |
|
|
|
history[nBlocksTruncated].RecordPriority(dPriority); |
|
|
|
assignedTo = "priority"; |
|
|
|
assignedTo = "priority"; |
|
|
|