fees: return current block height in estimateSmartFee
What changed, and why it matters
This commit simply adds the current blockchain block height to the data returned by Bitcoin Core's fee estimation feature. It does not change how fees are calculated, does not alter any security logic, and does not appear to fix a vulnerability. It is a minor informational API enhancement.
No security action required. Treat as routine feature/API improvement.
Security signals we found
No security-relevant code changes observed
No input validation changes
No cryptographic or consensus logic modified
No memory allocation or pointer changes
Evidence from the diff
The patch adds a best_height field to the FeeCalculation struct and populates it with nBestSeenHeight inside CBlockPolicyEstimator::estimateSmartFee(). This exposes the estimator’s latest known block height to callers that pass a FeeCalculation output object. No logic changes to fee estimation, no bounds checks removed, no memory safety issues introduced.
Changed components
src/policy/fees/block_policy_estimator.cppsrc/policy/fees/block_policy_estimator.hInspect captured patch +2 / −0
diff --git a/src/policy/fees/block_policy_estimator.cpp b/src/policy/fees/block_policy_estimator.cpp
index 791c4893..a3327cfa 100644
--- a/src/policy/fees/block_policy_estimator.cpp
+++ b/src/policy/fees/block_policy_estimator.cpp
@@ -875,6 +875,7 @@ CFeeRate CBlockPolicyEstimator::estimateSmartFee(int confTarget, FeeCalculation
if (feeCalc) {
feeCalc->desiredTarget = confTarget;
feeCalc->returnedTarget = confTarget;
+ feeCalc->best_height = nBestSeenHeight;
}
double median = -1;
diff --git a/src/policy/fees/block_policy_estimator.h b/src/policy/fees/block_policy_estimator.h
index 7cb9da8f..ed561d9a 100644
--- a/src/policy/fees/block_policy_estimator.h
+++ b/src/policy/fees/block_policy_estimator.h
@@ -95,6 +95,7 @@ struct FeeCalculation
FeeReason reason = FeeReason::NONE;
int desiredTarget = 0;
int returnedTarget = 0;
+ unsigned int best_height{0};
};
/** \class CBlockPolicyEstimator
Why this scored 17/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.