From 19784b510049a2ba9a04b0cf4e29f856d455a485 Mon Sep 17 00:00:00 2001 From: Szymon Lesisz Date: Wed, 19 Dec 2018 18:16:28 +0100 Subject: [PATCH] enable RippleDiscovery process from storage --- src/actions/LocalStorageActions.js | 2 +- src/reducers/DiscoveryReducer.js | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/src/actions/LocalStorageActions.js b/src/actions/LocalStorageActions.js index 03bca7bd..c3380891 100644 --- a/src/actions/LocalStorageActions.js +++ b/src/actions/LocalStorageActions.js @@ -61,7 +61,7 @@ const findAccounts = (devices: Array, accounts: Array): A const findTokens = (accounts: Array, tokens: Array): Array => accounts.reduce((arr, account) => arr.concat(findAccountTokens(tokens, account)), []); -const findDiscovery = (devices: Array, discovery: Array): Array => devices.reduce((arr, dev) => arr.concat(discovery.filter(a => a.deviceState === dev.state && a.publicKey.length > 0)), []); +const findDiscovery = (devices: Array, discovery: Array): Array => devices.reduce((arr, dev) => arr.concat(discovery.filter(d => d.deviceState === dev.state && d.completed)), []); const findPendingTxs = (accounts: Array, pending: Array): Array => accounts.reduce((result, account) => result.concat(pending.filter(p => p.address === account.address && p.network === account.network)), []); diff --git a/src/reducers/DiscoveryReducer.js b/src/reducers/DiscoveryReducer.js index a490e4a4..9f890e74 100644 --- a/src/reducers/DiscoveryReducer.js +++ b/src/reducers/DiscoveryReducer.js @@ -195,6 +195,9 @@ export default function discovery(state: State = initialState, action: Action): return notSupported(state, action); case DISCOVERY.FROM_STORAGE: return action.payload.map((d) => { + if (d.publicKey.length < 1) return d; + // recreate ethereum discovery HDKey + // deprecated: will be removed after switching to blockbook const hdKey: HDKey = new HDKey(); hdKey.publicKey = Buffer.from(d.publicKey, 'hex'); hdKey.chainCode = Buffer.from(d.chainCode, 'hex');