Skip to content

feat: Add fs store to block manager - #1

Closed
DerekCuevas wants to merge 1 commit into
mainfrom
feature/fs
Closed

feat: Add fs store to block manager#1
DerekCuevas wants to merge 1 commit into
mainfrom
feature/fs

Conversation

@DerekCuevas

@DerekCuevas DerekCuevas commented Dec 24, 2025

Copy link
Copy Markdown
Owner

Note

Introduces filesystem-backed storage for blocks and enables JSON (de)serialization across core types.

  • Implements BlockManager persistence: new data_dir, persist_block, load_from_disk, add_block_internal(persist), and constructors new/new_with_load; blocks saved as <hash>.json in ./data and loaded with orphan handling
  • Adds Serialize/Deserialize to Hash, BlockHeader, Block, Transaction*, and Address; custom serde for Signature and PublicKey (hex encoding); wraps raw [u8; 32] in Hash type and updates callers
  • Updates chain to consume Hash via as_ref(); minor logging/hex fixes using hash.0
  • Adds tests for persistence and loading; updates .gitignore to ignore ./data; adds serde_json dependency

Written by Cursor Bugbot for commit 94cfadf. Configure here.

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This PR is being reviewed by Cursor Bugbot

Details

You are on the Bugbot Free tier. On this plan, Bugbot will review limited PRs each billing cycle.

To receive Bugbot reviews on all of your PRs, visit the Cursor dashboard to activate Pro and start your 14-day free trial.

Comment thread src/block_manager.rs

Ok(())
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed blocks reappear after loading from disk

The remove_block function only removes blocks from memory but doesn't delete the corresponding JSON file from disk. Since add_block persists blocks via persist_block, this creates an inconsistency where removed blocks will reappear after calling load_from_disk(). Any block that was added, removed, and then loaded from disk will be restored to memory unexpectedly.

Additional Locations (1)

Fix in Cursor Fix in Web

@DerekCuevas DerekCuevas closed this Feb 4, 2026
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.

1 participant