Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: delete of account via RPC throws while node account rescan is active #4867

Merged
merged 1 commit into from
Apr 3, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
5 changes: 4 additions & 1 deletion ironfish/src/wallet/wallet.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1620,6 +1620,7 @@ export class Wallet {
})

this.accounts.set(account.id, account)
this.logger.debug(`Account ${account.id} imported successfully`)
this.onAccountImported.emit(account)

return account
Expand All @@ -1646,6 +1647,7 @@ export class Wallet {
id: uuid(),
walletDb: this.walletDb,
})
this.logger.debug(`Resetting account name: ${account.name}, id: ${account.id}`)

await this.walletDb.db.withTransaction(options?.tx, async (tx) => {
await this.walletDb.setAccount(newAccount, tx)
Expand All @@ -1672,6 +1674,7 @@ export class Wallet {
}

async removeAccount(account: Account, tx?: IDatabaseTransaction): Promise<void> {
this.accounts.delete(account.id)
await this.walletDb.db.withTransaction(tx, async (tx) => {
if (account.id === this.defaultAccount) {
await this.walletDb.setDefaultAccount(null, tx)
Expand All @@ -1682,7 +1685,7 @@ export class Wallet {
await this.walletDb.removeHead(account, tx)
})

this.accounts.delete(account.id)
this.logger.debug(`Removed account name: ${account.name}, id: ${account.id}`)
this.onAccountRemoved.emit(account)
}

Expand Down