prevent errant wallet servers error

This commit is contained in:
zeppi 2022-02-04 16:09:39 -05:00 committed by jessopb
parent fe72dcfc2c
commit 9a5f69f0eb

View file

@ -525,7 +525,7 @@ export function doSupportAbandonForClaim(claimId, claimType, keep, preview) {
} }
export function doWalletReconnect() { export function doWalletReconnect() {
return (dispatch) => { return (dispatch, getState) => {
dispatch({ dispatch({
type: ACTIONS.WALLET_RESTART, type: ACTIONS.WALLET_RESTART,
}); });
@ -533,16 +533,23 @@ export function doWalletReconnect() {
// this basically returns null when it's done. :( // this basically returns null when it's done. :(
// might be good to dispatch ACTIONS.WALLET_RESTARTED // might be good to dispatch ACTIONS.WALLET_RESTARTED
const walletTimeout = setTimeout(() => { const walletTimeout = setTimeout(() => {
failed = true; const state = getState();
dispatch({ const { settings } = state;
type: ACTIONS.WALLET_RESTART_COMPLETED, const { daemonStatus } = settings || {};
}); const { wallet } = daemonStatus || {};
dispatch( const availableServers = wallet.available_servers;
doToast({ if (!availableServers) {
message: __('Your servers were not available. Check your url and port, or switch back to defaults.'), failed = true;
isError: true, dispatch({
}) type: ACTIONS.WALLET_RESTART_COMPLETED,
); });
dispatch(
doToast({
message: __('Your servers were not available. Check your url and port, or switch back to defaults.'),
isError: true,
})
);
}
}, FIFTEEN_SECONDS); }, FIFTEEN_SECONDS);
Lbry.wallet_reconnect().then(() => { Lbry.wallet_reconnect().then(() => {
clearTimeout(walletTimeout); clearTimeout(walletTimeout);