Merge pull request #2336 from mempool/nymkappa/feature/stop-updating-closed-channels
If a channel is closed, stop updating it
This commit is contained in:
commit
3201caf54e
@ -95,11 +95,19 @@ class NetworkSyncService {
|
|||||||
*/
|
*/
|
||||||
private async $updateChannelsList(channels: ILightningApi.Channel[]): Promise<void> {
|
private async $updateChannelsList(channels: ILightningApi.Channel[]): Promise<void> {
|
||||||
try {
|
try {
|
||||||
|
const [closedChannelsRaw]: any[] = await DB.query(`SELECT id FROM channels WHERE status = 2`);
|
||||||
|
const closedChannels = {};
|
||||||
|
for (const closedChannel of closedChannelsRaw) {
|
||||||
|
closedChannels[Common.channelShortIdToIntegerId(closedChannel.id)] = true;
|
||||||
|
}
|
||||||
|
|
||||||
let progress = 0;
|
let progress = 0;
|
||||||
|
|
||||||
const graphChannelsIds: string[] = [];
|
const graphChannelsIds: string[] = [];
|
||||||
for (const channel of channels) {
|
for (const channel of channels) {
|
||||||
|
if (!closedChannels[channel.channel_id]) {
|
||||||
await channelsApi.$saveChannel(channel);
|
await channelsApi.$saveChannel(channel);
|
||||||
|
}
|
||||||
graphChannelsIds.push(channel.channel_id);
|
graphChannelsIds.push(channel.channel_id);
|
||||||
++progress;
|
++progress;
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user