Browse Source

fix(wallet): ensure clean state after refresh

The `onOnboarding` state transition handler only fires if you are
entering the `onboarding` state from another state. If you are already
in the `onboarding` state it does not fire when the `startOnboarding`
event is initiated. By contrast, `onStartOnboarding` always fires when
`startOnboarding` is run.

Ensure that IPC listeners are only registered once when transitioning to
the `onboarding` state from another state.
renovate/lint-staged-8.x
Tom Kirkpatrick 7 years ago
parent
commit
92e2dc5419
No known key found for this signature in database GPG Key ID: 72203A8EC5967EA8
  1. 10
      app/lib/zap/controller.js

10
app/lib/zap/controller.js

@ -130,9 +130,12 @@ class ZapController {
onOnboarding() { onOnboarding() {
mainLog.debug('[FSM] onOnboarding...') mainLog.debug('[FSM] onOnboarding...')
// Deregister IPC listeners so that we can start fresh. // Remove any existing IPC listeners so that we can start fresh.
this._removeIpcListeners() this._removeIpcListeners()
// Register IPC listeners so that we can react to instructions coming from the app.
this._registerIpcListeners()
// Ensure wallet is disconnected. // Ensure wallet is disconnected.
this.disconnectLightningWallet() this.disconnectLightningWallet()
@ -148,9 +151,6 @@ class ZapController {
onStartOnboarding() { onStartOnboarding() {
mainLog.debug('[FSM] onStartOnboarding...') mainLog.debug('[FSM] onStartOnboarding...')
// Register IPC listeners so that we can react to instructions coming from the app.
this._registerIpcListeners()
// Notify the app to start the onboarding process. // Notify the app to start the onboarding process.
this.sendMessage('startOnboarding', this.lndConfig) this.sendMessage('startOnboarding', this.lndConfig)
} }
@ -410,7 +410,7 @@ class ZapController {
process.env.GRPC_SSL_CIPHER_SUITES || grpcSslCipherSuites(options.type) process.env.GRPC_SSL_CIPHER_SUITES || grpcSslCipherSuites(options.type)
// If the requested connection type is a local one then start up a new lnd instance. // If the requested connection type is a local one then start up a new lnd instance.
// // Otherwise attempt to connect to an lnd instance using user supplied connection details. // Otherwise attempt to connect to an lnd instance using user supplied connection details.\
return options.type === 'local' ? this.startLnd() : this.connectLnd() return options.type === 'local' ? this.startLnd() : this.connectLnd()
} }

Loading…
Cancel
Save