Skip to content

Commit

Permalink
fix: when MINER is on, it accidentally switches accounts (#219) (#253)
Browse files Browse the repository at this point in the history
  • Loading branch information
BBK912 authored Feb 29, 2024
1 parent 9babc6d commit 761ac70
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
8 changes: 7 additions & 1 deletion src/components/wallet/Keygen.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,13 @@
import { invoke } from '@tauri-apps/api/tauri'
import { signingAccount } from '../../modules/accounts'
import type { CarpeProfile } from '../../modules/accounts'
import { minerLoopEnabled } from '../../modules/miner'
import { raise_error } from '../../modules/carpeError'
import { responses } from '../../modules/debug'
import AccountFromMnemSubmit from './AccountFromMnemSubmit.svelte'
import { onDestroy } from 'svelte'
import { get } from 'svelte/store'
interface NewKeygen {
entry: CarpeProfile
Expand All @@ -22,7 +25,10 @@
tempDangerDisplayMnem = res.mnem
res.mnem = null
responses.set(JSON.stringify(res))
signingAccount.set(res.entry)
// cannot switch profile with miner running
if (!get(minerLoopEnabled)) {
signingAccount.set(res.entry)
}
hide = false
})
.catch((e) => raise_error(e, true, 'do_keygen'))
Expand Down
5 changes: 4 additions & 1 deletion src/modules/accountActions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,10 @@ export const addAccount = async (init_type: InitType, secret: string) => {
// set as init so we don't get sent back to Newbie account creation.
isInit.set(true)
responses.set(JSON.stringify(res))
signingAccount.set(res)
// cannot switch profile with miner running
if (!get(minerLoopEnabled)) {
signingAccount.set(res)
}
await initNetwork()
// only navigate away once we have refreshed the accounts including balances
notify_success(`Account Added: ${res.nickname}`)
Expand Down

0 comments on commit 761ac70

Please sign in to comment.