node: remember a created wallet in the store's catalogue
All checks were successful
ci / test (pull_request) Successful in 5m53s
ci / sdk (pull_request) Successful in 1m35s
android-ci / android (pull_request) Successful in 12m30s
ci / fuzz (pull_request) Successful in 4m55s

A wallet created in-app was never remembered: `Node::wallet_create` called
the RPC and returned the seed, and the wallet file name was the one
hardcoded `wallet::DEFAULT_WALLET_FILENAME` ("onionwire"). A second create
reused that name, so the RPC refused it (or opened the first wallet's
file) and no row was ever written — the "cannot create a new wallet, and
nothing survives a restart" report.

Creation and import now go through the catalogue (t_64c9ba3c's
`Store::{create_wallet,list_wallets}`):

- each create/import gets its own file name, `onionwire-<n>` for the first
  `n` the catalogue does not hold, so several wallets coexist;
- the stored row (id, identity, locator, file, created_at) is returned:
  `Node::wallet_create` -> `CreatedWallet` (row + the one-time seed, with a
  redacting `Debug`), `Node::wallet_restore` -> `WalletRecord`;
- `Node::list_wallets` reads the catalogue without dialing;
- the child config is re-pointed at the new file (read-modify-write, so the
  sealed RPC creds survive) — a row the child never opens would still be a
  broken wallet.

The SDK keeps its UniFFI signature (`create_wallet -> String` seed,
`import_wallet -> ()`), so no Kotlin change: it unwraps `.seed`.

TDD: 5 new `src/node.rs` cases (row + list, two wallets + reopen, import,
wallet-off empty list, child re-pointed) over a loopback wallet-RPC mock.
`cargo test --locked` exit 0, `cargo clippy --locked --all-targets -- -D
warnings` clean, and the same two commands are clean in
`crates/onionwire-sdk`.
This commit is contained in:
agent 2026-09-21 10:57:55 -04:00
commit 0043fa0b34
No known key found for this signature in database
3 changed files with 262 additions and 15 deletions

View file

@ -2263,9 +2263,9 @@ impl App {
return Ok(());
}
match self.rt.block_on(self.node.wallet_create(pass.as_str())) {
Ok(seed) => {
Ok(created) => {
self.screen = Screen::WalletSetup(WalletSetup::CreateSeed {
seed: Zeroizing::new(seed),
seed: Zeroizing::new(created.seed),
typed: String::new(),
});
}
@ -2338,7 +2338,7 @@ impl App {
.block_on(self.node.wallet_restore(pass.as_str(), seed.as_str()));
seed.zeroize();
match result {
Ok(()) => {
Ok(_) => {
self.status_note = Some("wallet imported".into());
return self.open_wallet();
}