Skip to content

Conversation

@AlanRuno
Copy link
Owner

Summary

The -reset command was not properly wiping blockchain data, DHT peer table, and rapid stake table data because it was looking in the wrong directory (build/lib/data) instead of the actual data directory (./data) where the node stores all persistent data.

This PR fixes the issue by:

  1. Correcting the default data directory path from build/lib/data to ./data (matching the config's data_dir setting)
  2. Simplifying the reset function to remove the entire data directory instead of individual files, ensuring ALL data is wiped including node identity keys

Review & Testing Checklist for Human

  • Verify the data directory path is correct: Confirm that ./data is indeed where the node stores its data when running from the mxdlib root directory (check default_config.json has data_dir: "./data")
  • Test standalone reset: Run ./letsgo -reset and verify it removes the ./data directory contents
  • Test reset with network type: Run ./letsgo testnet -reset and verify the node starts fresh with a new identity after the reset
  • Verify node regenerates keys: After reset, confirm the node creates new identity keys in data/node_keys.v2 on startup

Recommended Test Plan

  1. On a test node with existing data, run ls -la data/ to see current contents
  2. Run ./letsgo -reset (answer 'y' to confirm)
  3. Verify the data directory is now empty (except for the directory itself)
  4. Run ./letsgo testnet and verify the node starts fresh and regenerates its identity

Notes

  • The reset now also deletes node identity keys (data/node_keys.v2), which will be regenerated on next startup. This is intentional per the "wipe everything" requirement.
  • The old approach tried to delete specific files like blockchain.db, blocks.db, peers.db which don't actually exist - all data is stored in utxo.db within the data directory.

Link to Devin run: https://app.devin.ai/sessions/02b7aca7d4b047d2911c624c278ccaaa
Requested by: Runo (@AlanRuno)

The reset command was looking in the wrong directory (build/lib/data) instead
of the actual data directory (./data) where the node stores all persistent data.

Changes:
- Fixed data directory path from 'build/lib/data' to './data' (matches config)
- Simplified reset function to remove entire data directory instead of
  individual files, ensuring ALL data is wiped including:
  - Blockchain data (UTXO database)
  - DHT peer table data
  - Rapid stake table data
  - Node identity keys (will be regenerated on next start)
- Updated usage examples to reflect correct default path
- Added clearer messaging about what will be deleted
@devin-ai-integration
Copy link

🤖 Devin AI Engineer

I'll be helping with this pull request! Here's what you should know:

✅ I will automatically:

  • Address comments on this PR. Add '(aside)' to your comment to have me ignore it.
  • Look at CI failures and help fix them

Note: I can only respond to comments from users who have write access to this repository.

⚙️ Control Options:

  • Disable automatic comment and CI monitoring

@AlanRuno AlanRuno merged commit 7216d71 into main Jan 18, 2026
8 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