Skip to content

Commit

Permalink
fix(lightning): Update handleOrderStateChange
Browse files Browse the repository at this point in the history
Swapped out restartLdk with refreshLdk in handleOrderStateChange.
Updated i18n import in lightning.ts.
Updated condition for lightningConnecting addTodo in lightning.ts.
  • Loading branch information
coreyphillips committed Aug 31, 2023
1 parent fddf66e commit 208f3c9
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
6 changes: 3 additions & 3 deletions src/store/actions/blocktank.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ import {
import { showToast } from '../../utils/notifications';
import { getDisplayValues } from '../../utils/displayValues';
import i18n from '../../utils/i18n';
import { restartLdk } from '../../utils/lightning';
import { refreshLdk } from '../../utils/lightning';
import { TWalletName } from '../types/wallet';
import { IBlocktank } from '../types/blocktank';
import {
Expand Down Expand Up @@ -424,8 +424,8 @@ const handleOrderStateChange = (order: IBtOrder): void => {
// }
removeTodo('transferToSpending');

// restart LDK after channel open
restartLdk();
// refresh LDK after channel open
refreshLdk({});
}
};

Expand Down
8 changes: 6 additions & 2 deletions src/store/actions/lightning.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,8 @@ import {
import { EPaymentType, TWalletName } from '../types/wallet';
import { EActivityType, TLightningActivityItem } from '../types/activity';
import { addTodo, removeTodo } from './todos';
import i18n from 'i18next';
import i18n from '../../utils/i18n';

import { showToast } from '../../utils/notifications';

const dispatch = getDispatch();
Expand Down Expand Up @@ -140,7 +141,6 @@ export const updateLightningChannels = async ({
const confirmations_required = channel?.confirmations_required ?? 1;
if (channel.confirmations < confirmations_required) {
shouldRemoveTodo = false;
addTodo('lightningConnecting');
}
}
if (!openChannelIds.includes(channel.channel_id)) {
Expand All @@ -162,6 +162,10 @@ export const updateLightningChannels = async ({
}
}

if (!shouldRemoveTodo && !openChannelIds.length) {
addTodo('lightningConnecting');
}

const payload = {
channels,
openChannelIds,
Expand Down

0 comments on commit 208f3c9

Please sign in to comment.