Fix DB lock error: clear message + instructions, fix passphrase reprompt

Storage:
- Detects sled lock contention, shows actionable error:
  "Database locked by another warzone process"
  with ps command to find the process and rm command to force unlock

TUI:
- Poll loop no longer calls load_seed() (was re-prompting passphrase)
- Seed passed from main.rs to run_tui to poll_loop
- Single passphrase prompt per app launch

Warnings fixed:
- Removed unused `Context` import in tui/app.rs
- Added #[allow(dead_code)] on validate_token (used when auth middleware wired)

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
Siavash Sameni
2026-03-27 08:24:53 +04:00
parent c8b51fa96b
commit d7b71efdbc
4 changed files with 28 additions and 6 deletions

View File

@@ -70,6 +70,8 @@ async fn main() -> anyhow::Result<()> {
// All other commands need the seed — unlock once here
let seed = keystore::load_seed()?;
// Create a copy for the poll thread (Seed doesn't impl Clone due to Zeroize)
let poll_seed = warzone_protocol::identity::Seed::from_bytes(seed.0);
let identity = seed.derive_identity();
let our_fp = identity.public_identity().fingerprint.to_string();
@@ -98,7 +100,7 @@ async fn main() -> anyhow::Result<()> {
Commands::Chat { peer, server } => {
let _ = cli::init::register_with_server_identity(&server, &identity).await;
let db = storage::LocalDb::open()?;
tui::run_tui(our_fp, peer, server, identity, db).await?;
tui::run_tui(our_fp, peer, server, identity, poll_seed, db).await?;
}
}