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(ironfish): Fix unlock hanging in memory client CLI #5392

Merged
merged 1 commit into from
Sep 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion ironfish/src/rpc/clients/memoryClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,5 +30,7 @@ export class RpcMemoryClient extends RpcClient {
return RpcMemoryAdapter.requestStream<TEnd, TStream>(this.router, route, data)
}

close(): void {}
async close(): Promise<void> {
await this.node.stopNode()
}
}
2 changes: 1 addition & 1 deletion ironfish/src/rpc/routes/node/stopNode.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ routes.register<typeof StopNodeRequestSchema, StopNodeResponse>(
async (request, context): Promise<void> => {
AssertHasRpcContext(request, context, 'shutdown', 'logger')

context.logger.withTag('stopnode').info('Shutting down')
context.logger.withTag('stopnode').debug('Shutting down')
request.end()
await context.shutdown()
},
Expand Down
2 changes: 0 additions & 2 deletions ironfish/src/wallet/masterKey.ts
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,5 @@ export class MasterKey {

async destroy(): Promise<void> {
await this.lock()
this.nonce.fill(0)
this.salt.fill(0)
}
}
12 changes: 6 additions & 6 deletions ironfish/src/wallet/wallet.ts
Original file line number Diff line number Diff line change
Expand Up @@ -280,6 +280,12 @@ export class Wallet {
}

async stop(): Promise<void> {
if (this.masterKey) {
await this.masterKey.destroy()
}

this.stopUnlockTimeout()

if (!this.isStarted) {
return
}
Expand All @@ -289,12 +295,6 @@ export class Wallet {
clearTimeout(this.eventLoopTimeout)
}

if (this.masterKey) {
await this.masterKey.destroy()
}

this.stopUnlockTimeout()

await this.scanner.abort()
this.eventLoopAbortController.abort()
await this.eventLoopPromise
Expand Down