What changed, and why it matters
This patch adds a safety check in the Monero wallet's fee-priority logic. Previously, if the blockchain's block weight limit was set to zero (an unusual or malformed state), the code would divide it by two and then use that zero value in later calculations, which could cause a division-by-zero or other bad behavior when deciding transaction fees. The fix makes the wallet fall back to the lowest fee priority instead of continuing with the bad value.
Apply the patch. It is a low-risk defensive fix. Users and integrators should ensure they run a version containing this guard, especially if interacting with custom or test networks where block_weight_limit might be unusually low.
Security signals we found
Defensive guard against zero denominator derived from network/block parameter
Potential division-by-zero or undefined behavior in fee estimation path
Patch is minimal and targeted at a single edge case
Evidence from the diff
In wallet2::adjust_priority(), full_reward_zone is computed as block_weight_limit / 2. The patch guards against full_reward_zone == 0 and returns fee_priority::Unimportant early. Without the guard, downstream code that divides by full_reward_zone or compares against it could trigger undefined behavior (division by zero) or incorrect priority selection when block_weight_limit is zero or one. The change is defensive and minimal.
Changed components
src/wallet/wallet2.cppwallet2::adjust_priority()transaction fee priority selectionInspect captured patch +2 / −0
### src/wallet/wallet2.cpp
@@ -9274,6 +9274,8 @@ fee_priority wallet2::adjust_priority(fee_priority priority)
if (result)
return fee_priority::Unimportant;
const uint64_t full_reward_zone = block_weight_limit / 2;
+ if (full_reward_zone == 0)
+ return fee_priority::Unimportant;
// get the last N block headers and sum the block sizes
const size_t N = 10;Why this scored 32/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.