Commit 3201b31
feat(context): re-key AppContext.wallets map from seed_hash to wallet_id
Commit 4 of the seed_hash → wallet_id refactor. This is the
behavioral change — the wallets map key is now wallet_id bytes
instead of seed_hash bytes.
AppContext::new (DB load):
Map key = wallet.wallet_id() if populated (v40+ wallets that
have been opened), else wallet.seed_hash() as fallback for
locked wallets that haven't been unlocked since v40.
register_wallet:
Uses wallet.wallet_id().unwrap_or(seed_hash) — newly created
wallets always have wallet_id (seed is open at creation time).
register_with_platform_wallet_manager:
After computing wallet_id from the seed, re-keys the map entry
from seed_hash to wallet_id if the wallet was inserted before
wallet_id was available (password-protected wallet's first
unlock since v40). Uses write lock + remove + insert pattern.
Also sets managed.wallet_id = Some(wallet_id) (real wallet_id
bytes, no longer seed_hash as transition placeholder).
handle_wallet_locked:
Uses wallet.wallet_id() for identification (with seed_hash
fallback). Does NOT remove the map entry — locked wallets
stay visible in the UI.
get_platform_wallet / require_platform_wallet:
Parameter renamed seed_hash → wallet_key for clarity. The
underlying logic is unchanged (map lookup by key).
Post this commit, code that passes wallet_id bytes to
get_platform_wallet will find the correct entry. Code that still
passes seed_hash bytes will fail for wallets that have been
re-keyed — but all identity/contact discovery code flows through
platform-wallet which populates wallet_id bytes, so post-v40
(all identities re-discovered) the lookup values are correct.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>1 parent 4a8b2a3 commit 3201b31
2 files changed
+51
-22
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
325 | 325 | | |
326 | 326 | | |
327 | 327 | | |
328 | | - | |
| 328 | + | |
| 329 | + | |
| 330 | + | |
| 331 | + | |
| 332 | + | |
| 333 | + | |
| 334 | + | |
329 | 335 | | |
330 | 336 | | |
331 | 337 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
63 | 63 | | |
64 | 64 | | |
65 | 65 | | |
66 | | - | |
| 66 | + | |
67 | 67 | | |
68 | | - | |
| 68 | + | |
| 69 | + | |
69 | 70 | | |
70 | 71 | | |
71 | | - | |
| 72 | + | |
72 | 73 | | |
73 | 74 | | |
74 | 75 | | |
75 | 76 | | |
76 | | - | |
| 77 | + | |
77 | 78 | | |
78 | 79 | | |
79 | 80 | | |
| |||
90 | 91 | | |
91 | 92 | | |
92 | 93 | | |
93 | | - | |
| 94 | + | |
94 | 95 | | |
95 | 96 | | |
96 | 97 | | |
97 | 98 | | |
98 | | - | |
| 99 | + | |
99 | 100 | | |
100 | | - | |
| 101 | + | |
101 | 102 | | |
102 | 103 | | |
103 | 104 | | |
| |||
225 | 226 | | |
226 | 227 | | |
227 | 228 | | |
228 | | - | |
| 229 | + | |
| 230 | + | |
| 231 | + | |
| 232 | + | |
| 233 | + | |
229 | 234 | | |
230 | 235 | | |
231 | 236 | | |
232 | 237 | | |
233 | | - | |
| 238 | + | |
234 | 239 | | |
235 | 240 | | |
236 | 241 | | |
237 | 242 | | |
238 | 243 | | |
239 | 244 | | |
240 | | - | |
| 245 | + | |
241 | 246 | | |
242 | 247 | | |
243 | 248 | | |
| |||
331 | 336 | | |
332 | 337 | | |
333 | 338 | | |
334 | | - | |
335 | | - | |
336 | | - | |
| 339 | + | |
| 340 | + | |
| 341 | + | |
| 342 | + | |
| 343 | + | |
| 344 | + | |
| 345 | + | |
| 346 | + | |
| 347 | + | |
| 348 | + | |
| 349 | + | |
| 350 | + | |
337 | 351 | | |
338 | 352 | | |
339 | 353 | | |
340 | 354 | | |
| 355 | + | |
| 356 | + | |
341 | 357 | | |
342 | 358 | | |
343 | 359 | | |
| |||
358 | 374 | | |
359 | 375 | | |
360 | 376 | | |
361 | | - | |
362 | | - | |
| 377 | + | |
| 378 | + | |
| 379 | + | |
| 380 | + | |
| 381 | + | |
363 | 382 | | |
364 | 383 | | |
365 | 384 | | |
| |||
371 | 390 | | |
372 | 391 | | |
373 | 392 | | |
| 393 | + | |
| 394 | + | |
374 | 395 | | |
375 | 396 | | |
376 | 397 | | |
| 398 | + | |
| 399 | + | |
| 400 | + | |
| 401 | + | |
| 402 | + | |
| 403 | + | |
377 | 404 | | |
378 | 405 | | |
379 | 406 | | |
| |||
928 | 955 | | |
929 | 956 | | |
930 | 957 | | |
931 | | - | |
932 | | - | |
933 | | - | |
934 | | - | |
935 | | - | |
| 958 | + | |
936 | 959 | | |
937 | 960 | | |
938 | 961 | | |
| |||
963 | 986 | | |
964 | 987 | | |
965 | 988 | | |
966 | | - | |
| 989 | + | |
967 | 990 | | |
968 | 991 | | |
969 | 992 | | |
| |||
0 commit comments