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
						f66b97e9b4
					
				@ -95,11 +95,19 @@ class NetworkSyncService {
 | 
			
		||||
   */
 | 
			
		||||
  private async $updateChannelsList(channels: ILightningApi.Channel[]): Promise<void> {
 | 
			
		||||
    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;
 | 
			
		||||
 | 
			
		||||
      const graphChannelsIds: string[] = [];
 | 
			
		||||
      for (const channel of channels) {
 | 
			
		||||
        await channelsApi.$saveChannel(channel);
 | 
			
		||||
        if (!closedChannels[channel.channel_id]) {
 | 
			
		||||
          await channelsApi.$saveChannel(channel);
 | 
			
		||||
        }
 | 
			
		||||
        graphChannelsIds.push(channel.channel_id);
 | 
			
		||||
        ++progress;
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user