diff options
Diffstat (limited to 'MINING_WORKTREE_PLAN.md')
| -rw-r--r-- | MINING_WORKTREE_PLAN.md | 72 |
1 files changed, 72 insertions, 0 deletions
diff --git a/MINING_WORKTREE_PLAN.md b/MINING_WORKTREE_PLAN.md new file mode 100644 index 0000000..815e657 --- /dev/null +++ b/MINING_WORKTREE_PLAN.md | |||
| @@ -0,0 +1,72 @@ | |||
| 1 | # Mining Feature: Git Worktree Implementation Plan | ||
| 2 | |||
| 3 | ## Overview | ||
| 4 | Implement Bitcoin mining-for-bandwidth in a proper git worktree so the shared `esp32-tollgate` repo stays clean for other LLM sessions. | ||
| 5 | |||
| 6 | ## Worktree Location | ||
| 7 | - **Shared repo:** `/home/c03rad0r/esp32-tollgate` (stays on `master`, always clean) | ||
| 8 | - **Mining worktree:** `/home/c03rad0r/esp32-tollgate-mining` (on `feature/mining-payment` branch) | ||
| 9 | |||
| 10 | ## Checklist | ||
| 11 | |||
| 12 | ### Phase 1: Cleanup & Setup | ||
| 13 | - [x] 1.1 Backup all mining files to `/home/c03rad0r/mining-work-backup/` | ||
| 14 | - [x] 1.2 Restore shared repo to clean master (discard edits, remove untracked, delete accidental branches) | ||
| 15 | - [x] 1.3 Create `feature/mining-payment` branch from master | ||
| 16 | - [x] 1.4 Create git worktree at `/home/c03rad0r/esp32-tollgate-mining` | ||
| 17 | - [x] 1.5 Copy backup files into worktree | ||
| 18 | - [x] 1.6 Verify worktree is clean and on correct branch | ||
| 19 | |||
| 20 | ### Phase 2: Apply Tracked File Edits (in worktree) | ||
| 21 | - [x] 2.1 Edit `main/CMakeLists.txt` — add 6 mining source files + `tcp_transport` | ||
| 22 | - [x] 2.2 Edit `main/config.h` — add `mining_payout_mode_t` enum + mining fields | ||
| 23 | - [x] 2.3 Edit `main/config.c` — add mining defaults + JSON parsing | ||
| 24 | - [x] 2.4 Edit `main/tollgate_main.c` — mining includes, init, tick | ||
| 25 | - [x] 2.5 Edit `main/tollgate_api.c` — 3 mining endpoints + discovery tag | ||
| 26 | - [x] 2.6 Edit `main/session.h` — `payment_method_t` enum + field | ||
| 27 | - [x] 2.7 Edit `main/session.c` — set payment_method in create functions | ||
| 28 | - [x] 2.8 Edit `main/firewall.h` — `firewall_set_mining_port()` + `firewall_set_sandbox_mint_access()` | ||
| 29 | - [x] 2.9 Edit `main/firewall.c` — sandbox allowlist + includes | ||
| 30 | - [x] 2.10 Edit `main/tollgate_client.h` — `TG_CLIENT_MINING` state + mining discovery fields | ||
| 31 | - [x] 2.11 Edit `main/tollgate_client.c` — mining tag parsing in discovery | ||
| 32 | - [x] 2.12 Edit `main/captive_portal.c` — tabbed UI with Cashu/Mine tabs | ||
| 33 | - [x] 2.13 N/A — esp-miner not in worktree (not needed as component) | ||
| 34 | |||
| 35 | ### Phase 3: Build & Test (in worktree) | ||
| 36 | - [x] 3.1 Clean build from scratch (`rm -rf build && idf.py build`) | ||
| 37 | - Note: Pre-existing nucula_lib build error (`save_proofs()` is private) blocks full link | ||
| 38 | - All mining-specific source files passed compilation | ||
| 39 | - nucula_lib error exists in both main repo and worktree (not caused by mining changes) | ||
| 40 | - [x] 3.2 Run existing unit tests (`make test-unit`) | ||
| 41 | - [x] 3.3 All tests pass (84/84: 61 existing + 23 new mining_payment) | ||
| 42 | |||
| 43 | ### Phase 4: Missing Unit Tests | ||
| 44 | - [ ] 4.1 `test_stratum_proxy.c` — job management, stats | ||
| 45 | - [ ] 4.2 `test_session_payment_method.c` — payment_method field | ||
| 46 | - [ ] 4.3 `test_tollgate_client_mining.c` — mining discovery tag parsing | ||
| 47 | - [ ] 4.4 `test_firewall_sandbox.c` — sandbox allowlist logic | ||
| 48 | - [ ] 4.5 All new tests pass | ||
| 49 | |||
| 50 | ### Phase 5: Commit | ||
| 51 | - [x] 5.1 Stage all changes in worktree (2 commits made) | ||
| 52 | - [x] 5.2 Commit with descriptive messages | ||
| 53 | - [ ] 5.3 Push branch to origin (Nostr git relay issue — branch exists locally) | ||
| 54 | |||
| 55 | ### Phase 6: Merge (when ready) | ||
| 56 | - [ ] 6.1 Squash-merge `feature/mining-payment` into `master` | ||
| 57 | - [ ] 6.2 Remove worktree | ||
| 58 | - [ ] 6.3 Push master | ||
| 59 | |||
| 60 | ## Commits Made | ||
| 61 | 1. `c75230e` — feat(mining): add new mining source files and unit tests | ||
| 62 | 2. `beb73a2` — feat(mining): integrate mining subsystem into existing modules | ||
| 63 | |||
| 64 | ## Known Issues (pre-existing) | ||
| 65 | - `nucula_lib/nucula_wallet.cpp` calls private `save_proofs()` — build error in both repos | ||
| 66 | - Nostr git relay (`relay.ngit.dev`) rejected push — branch exists locally only | ||
| 67 | |||
| 68 | ## Rules | ||
| 69 | - **NEVER** edit files in `/home/c03rad0r/esp32-tollgate/` directly | ||
| 70 | - **ALL** work happens in `/home/c03rad0r/esp32-tollgate-mining/` | ||
| 71 | - **Commit frequently** — don't lose work again | ||
| 72 | - No comments in code unless explicitly requested | ||