From 6b15a2cf61963eef134baa4664df4ec848ce241f Mon Sep 17 00:00:00 2001 From: Matthew Zipkin Date: Sun, 17 May 2020 20:19:57 -0400 Subject: [PATCH] Wait for wallet init before fetching history (#139) --- app/ducks/node.js | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/app/ducks/node.js b/app/ducks/node.js index ba3b7ca5c..6f94249c0 100644 --- a/app/ducks/node.js +++ b/app/ducks/node.js @@ -1,5 +1,5 @@ import { clientStub } from '../background/node/client'; -import { getNetwork, setNetwork } from '../db/system'; +import { getNetwork, setNetwork, getInitializationState } from '../db/system'; import { fetchWallet, fetchTransactions } from './walletActions'; import { getWatching } from './watching'; import * as logger from '../utils/logClient'; @@ -40,9 +40,11 @@ export const start = (network) => async (dispatch, getState) => { }); await dispatch(setNodeInfo()); await dispatch(fetchWallet()); - await dispatch(fetchTransactions()); - await dispatch(getWatching(network)); - await dispatch(onNewBlock()); + if (await getInitializationState(network)) { + await dispatch(fetchTransactions()); + await dispatch(getWatching(network)); + await dispatch(onNewBlock()); + } } catch (error) { dispatch({ type: START_ERROR,