Fix ln close classification logic
This commit is contained in:
		
							parent
							
								
									9bb897307f
								
							
						
					
					
						commit
						022785a555
					
				@ -289,6 +289,24 @@ class NetworkSyncService {
 | 
			
		||||
    1. Mutually closed
 | 
			
		||||
    2. Forced closed
 | 
			
		||||
    3. Forced closed with penalty
 | 
			
		||||
 | 
			
		||||
    ┌────────────────────────────────────┐       ┌────────────────────────────┐
 | 
			
		||||
    │ outputs contain revocation script? ├──yes──► force close w/ penalty = 3 │
 | 
			
		||||
    └──────────────┬─────────────────────┘       └────────────────────────────┘
 | 
			
		||||
                   no
 | 
			
		||||
    ┌──────────────▼──────────────────────────┐
 | 
			
		||||
    │ outputs contain other lightning script? ├──┐
 | 
			
		||||
    └──────────────┬──────────────────────────┘  │
 | 
			
		||||
                   no                           yes
 | 
			
		||||
    ┌──────────────▼─────────────┐               │
 | 
			
		||||
    │ sequence starts with 0x80  │      ┌────────▼────────┐
 | 
			
		||||
    │           and              ├──────► force close = 2 │
 | 
			
		||||
    │ locktime starts with 0x20? │      └─────────────────┘
 | 
			
		||||
    └──────────────┬─────────────┘
 | 
			
		||||
                   no
 | 
			
		||||
         ┌─────────▼────────┐
 | 
			
		||||
         │ mutual close = 1 │
 | 
			
		||||
         └──────────────────┘
 | 
			
		||||
  */
 | 
			
		||||
 | 
			
		||||
  private async $runClosedChannelsForensics(): Promise<void> {
 | 
			
		||||
@ -326,10 +344,6 @@ class NetworkSyncService {
 | 
			
		||||
              lightningScriptReasons.push(lightningScript);
 | 
			
		||||
            }
 | 
			
		||||
          }
 | 
			
		||||
          if (lightningScriptReasons.length === outspends.length
 | 
			
		||||
            && lightningScriptReasons.filter((r) => r === 1).length === outspends.length) {
 | 
			
		||||
            reason = 1;
 | 
			
		||||
          } else {
 | 
			
		||||
          const filteredReasons = lightningScriptReasons.filter((r) => r !== 1);
 | 
			
		||||
          if (filteredReasons.length) {
 | 
			
		||||
            if (filteredReasons.some((r) => r === 2 || r === 4)) {
 | 
			
		||||
@ -357,7 +371,6 @@ class NetworkSyncService {
 | 
			
		||||
              reason = 1;
 | 
			
		||||
            }
 | 
			
		||||
          }
 | 
			
		||||
          }
 | 
			
		||||
          if (reason) {
 | 
			
		||||
            logger.debug('Setting closing reason ' + reason + ' for channel: ' + channel.id + '.');
 | 
			
		||||
            await DB.query(`UPDATE channels SET closing_reason = ? WHERE id = ?`, [reason, channel.id]);
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user