From 741db60e6b808b19b2bd53e594ad7325b0a2a14b Mon Sep 17 00:00:00 2001 From: Hugh Cunningham Date: Mon, 11 Nov 2024 17:14:27 -0800 Subject: [PATCH] removes passphrase prompt from start command displays error message to user instead removes logic plumbing passphrase through openDB to migrator --- ironfish-cli/src/commands/start.ts | 31 ++++++++++-------------------- ironfish/src/node.ts | 3 +-- ironfish/src/utils/node.ts | 8 ++------ 3 files changed, 13 insertions(+), 29 deletions(-) diff --git a/ironfish-cli/src/commands/start.ts b/ironfish-cli/src/commands/start.ts index eebc576ab6..6346d1c999 100644 --- a/ironfish-cli/src/commands/start.ts +++ b/ironfish-cli/src/commands/start.ts @@ -33,7 +33,6 @@ import { RpcUseTcpFlagKey, } from '../flags' import { ONE_FISH_IMAGE } from '../images' -import { inputPrompt } from '../ui' export const ENABLE_TELEMETRY_CONFIG_KEY = 'enableTelemetry' const DEFAULT_ACCOUNT_NAME = 'default' @@ -230,26 +229,16 @@ export default class Start extends IronfishCommand { } this.log(` `) - let walletPassphrase: string | undefined - - // eslint-disable-next-line no-constant-condition - while (true) { - try { - await NodeUtils.waitForOpen(node, () => this.closing, walletPassphrase) - break - } catch (e) { - if (e instanceof EncryptedWalletMigrationError) { - this.logger.info(e.message) - walletPassphrase = await inputPrompt( - 'Enter your passphrase to unlock the wallet', - true, - { - password: true, - }, - ) - } else { - throw e - } + try { + await NodeUtils.waitForOpen(node, () => this.closing) + } catch (e) { + if (e instanceof EncryptedWalletMigrationError) { + this.logger.error(e.message) + this.logger.error( + 'Run `ironfish migrations:start` to enter wallet passphrase and migrate wallet databases', + ) + } else { + throw e } } diff --git a/ironfish/src/node.ts b/ironfish/src/node.ts index 2da1ae4fe2..319ab9654c 100644 --- a/ironfish/src/node.ts +++ b/ironfish/src/node.ts @@ -354,7 +354,7 @@ export class FullNode { return node } - async openDB(walletPassphrase?: string): Promise { + async openDB(): Promise { const migrate = this.config.get('databaseMigrate') const initial = await this.migrator.isInitial() @@ -362,7 +362,6 @@ export class FullNode { await this.migrator.migrate({ quiet: !migrate, quietNoop: true, - walletPassphrase: walletPassphrase, }) } diff --git a/ironfish/src/utils/node.ts b/ironfish/src/utils/node.ts index daa39b6068..dc13eae3b4 100644 --- a/ironfish/src/utils/node.ts +++ b/ironfish/src/utils/node.ts @@ -9,16 +9,12 @@ import { PromiseUtils } from './promise' /** * Try to open the node DB's and wait until they can be opened */ -async function waitForOpen( - node: FullNode, - abort?: null | (() => boolean), - walletPassphrase?: string, -): Promise { +async function waitForOpen(node: FullNode, abort?: null | (() => boolean)): Promise { let logged = false while (!abort || !abort()) { try { - await node.openDB(walletPassphrase) + await node.openDB() return } catch (e) { if (e instanceof DatabaseIsLockedError) {