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
constexpr
CFeeRate constructors to support compile-time constants - Replace magic
CFeeRate(0)
values with descriptive named constants:DEFAULT_FEERATE
for default/unset fee ratesNO_FEE_DATA
for fee estimation failuresFEERATE_DISABLED
for 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
constexpr
constructors - 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