From 30d69d7ed5fba0b5d1981944f51f50b9ed4924f3 Mon Sep 17 00:00:00 2001 From: Chris Duncan Date: Wed, 23 Jul 2025 08:21:02 -0700 Subject: [PATCH] Provide more info when wallet destruction fails. --- src/lib/wallets/wallet.ts | 29 ++++++++++++++++------------- 1 file changed, 16 insertions(+), 13 deletions(-) diff --git a/src/lib/wallets/wallet.ts b/src/lib/wallets/wallet.ts index 673435b..97898e4 100644 --- a/src/lib/wallets/wallet.ts +++ b/src/lib/wallets/wallet.ts @@ -136,20 +136,23 @@ export abstract class Wallet { * allow garbage collection. */ async destroy (): Promise { - let i = 0 - for (const a in this.#accounts) { - await this.#accounts[a].destroy() - delete this.#accounts[a] - i++ + try { + for (const a in this.#accounts) { + await this.#accounts[a].destroy() + delete this.#accounts[a] + } + bytes.erase(this.#s) + this.#s = null + this.#m = null + await SafeWorker.assign({ + store: 'Wallet', + method: 'destroy', + [this.id]: this.id + }) + } catch (err) { + console.error(err) + throw new Error('failed to destroy wallet', { cause: err }) } - this.#m = null - bytes.erase(this.#s) - this.#s = null - await SafeWorker.assign({ - store: 'Wallet', - method: 'destroy', - [this.id]: this.id - }) } /** -- 2.47.3