fees: make estimateSmartFee/HighestTargetTracked virtual for mocking
What changed, and why it matters
This commit simply changes two function declarations in a header file from regular methods to virtual methods. Virtual methods can be overridden in subclasses, which is useful for testing with mock objects. There is no security issue here.
No security action required. This is a benign testability/refactoring change.
Security signals we found
No strong security signals were identified.
Evidence from the diff
The commit modifies src/policy/fees.h to add the ‘virtual’ keyword to CBlockPolicyEstimator::estimateSmartFee and CBlockPolicyEstimator::HighestTargetTracked. This enables these methods to be overridden by mock implementations in unit tests. The function signatures, return types, const-qualifiers, and thread-safety annotations are unchanged. No behavioral or security changes are introduced.
Changed components
src/policy/fees.hInspect captured patch +2 / −2
diff --git a/src/policy/fees.h b/src/policy/fees.h
index b355b65a..e5820508 100644
--- a/src/policy/fees.h
+++ b/src/policy/fees.h
@@ -224,7 +224,7 @@ public:
* the closest target where one can be given. 'conservative' estimates are
* valid over longer time horizons also.
*/
- CFeeRate estimateSmartFee(int confTarget, FeeCalculation *feeCalc, bool conservative) const
+ virtual CFeeRate estimateSmartFee(int confTarget, FeeCalculation *feeCalc, bool conservative) const
EXCLUSIVE_LOCKS_REQUIRED(!m_cs_fee_estimator);
/** Return a specific fee estimate calculation with a given success
@@ -248,7 +248,7 @@ public:
EXCLUSIVE_LOCKS_REQUIRED(!m_cs_fee_estimator);
/** Calculation of highest target that estimates are tracked for */
- unsigned int HighestTargetTracked(FeeEstimateHorizon horizon) const
+ virtual unsigned int HighestTargetTracked(FeeEstimateHorizon horizon) const
EXCLUSIVE_LOCKS_REQUIRED(!m_cs_fee_estimator);
/** Drop still unconfirmed transactions and record current estimations, if the fee estimation file is present. */
Why this scored 15/100
Community notes
Notes can correct, qualify, or add evidence to the AI analysis. Every note shown here has been validated by a human moderator.
The AI analysis stands alone for now. Submit a note if you can add evidence or important context.