Force explicit double -> int conversion for CFeeRate constructor
This resolves an issue where estimatesmartfee would return 999 sat/byte instead of 1000, due to floating point loss of precision Thanks to sipa for suggesting is_integral.
This commit is contained in:
+2
-2
@@ -714,7 +714,7 @@ CFeeRate CBlockPolicyEstimator::estimateRawFee(int confTarget, double successThr
|
||||
if (median < 0)
|
||||
return CFeeRate(0);
|
||||
|
||||
return CFeeRate(median);
|
||||
return CFeeRate(llround(median));
|
||||
}
|
||||
|
||||
unsigned int CBlockPolicyEstimator::HighestTargetTracked(FeeEstimateHorizon horizon) const
|
||||
@@ -901,7 +901,7 @@ CFeeRate CBlockPolicyEstimator::estimateSmartFee(int confTarget, FeeCalculation
|
||||
|
||||
if (median < 0) return CFeeRate(0); // error condition
|
||||
|
||||
return CFeeRate(median);
|
||||
return CFeeRate(llround(median));
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user