Skip to content

fix: reset cached height after blockchain recovery clear - #225

Merged
sanada08 merged 1 commit into
Beldex-Coin:devfrom
victor-tucci:dev
Sep 9, 2026
Merged

sanada08 merged 1 commit into
Beldex-Coin:devfrom
victor-tucci:dev

Conversation

@victor-tucci

Copy link
Copy Markdown
Member

Reset m_cached_height from the cleared blockchain size before validation checks, preventing stale pre-recovery height from being used if recovery exits early with an exception.

@coderabbitai

coderabbitai Bot commented Sep 9, 2026

Copy link
Copy Markdown

Review Change StackReview Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: ASSERTIVE

Plan: Advanced

Run ID: 4d720508-0ded-4baa-a2e8-dc3ee0d2465c

📥 Commits

Reviewing files that changed from the base of the PR and between 67935d7 and 20f8708.

📒 Files selected for processing (1)
  • src/wallet/wallet2.cpp

Included review availability: Your plan provides up to 1 included review per hour; 0 remain after this review.


📝 Summary

Summary by CodeRabbit

  • Bug Fixes
    • Corrected wallet refresh behavior so the cached blockchain height remains synchronized after the hash chain is cleared and restored.

Walkthrough

The wallet refresh hash-chain reset now assigns m_cached_height from the current blockchain size instead of incrementing its previous value.

Changes

Wallet refresh

Layer / File(s) Summary
Synchronize cached height after reset
src/wallet/wallet2.cpp
The hash-chain reset path sets m_cached_height to m_blockchain.size() after clearing and restoring the chain.

Priority: ⬇️ Low

Estimated code review effort: 1 (Trivial) | ~2 minutes

Merge Risk: ⚪ Minimal · up to 20f87

Wallet refresh recovery now realigns cached height with the rebuilt blockchain size, preventing stale height use after a recovery clear. No current merge-blocking risk remains.

Suggested reviewers: tore-tto, deen-kakarot, agatha-luna

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly describes the main change: resetting the cached height after clearing the blockchain during recovery.
Description check ✅ Passed The description directly explains the cached-height reset and the stale-height issue that the change prevents.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff. Analyzed 0 functions across 0…
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

A rabbit watched the chain reset
The cached height found its mark
No extra hop, no stale step
The blockchain size now lights the dark
Soft paws approve the tidy fix

Comment @coderabbitai help to get the list of available commands.

@sanada08
sanada08 merged commit 115e725 into Beldex-Coin:dev Sep 9, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants