Summary
This PR addresses a TODO item in the wallet fee handling code by replacing magic numbers with descriptive named constants. It also adds constexpr constructors to CFeeRate to support compile-time constants.
Changes
- Add
constexprCFeeRate constructors to support compile-time constants - Replace magic
CFeeRate(0)values with descriptive named constants:DEFAULT_FEERATEfor default/unset fee ratesNO_FEE_DATAfor fee estimation failuresFEERATE_DISABLEDfor disabled fee features
- Remove resolved TODO comment in
src/wallet/fees.cpp:44(magic value of 0) - Update comments to be more descriptive
Benefits
This improves code readability and maintainability by:
- Eliminating magic numbers and centralizing fee rate constants
- Making the code’s intent clearer
- Reducing the risk of mistakes when comparing fee rates in different contexts
- Enabling compile-time constant initialization with
constexprconstructors - Providing compile-time safety for fee rate constants
Testing
- Local build successful (RelWithDebInfo, GCC 12.2.0, Linux)
- No behavioral changes introduced
- No new compiler warnings
Note: Local development build only - not a full Guix reproducible build.
Related
Fixes TODO item in src/wallet/fees.cpp:44