Improve taproot detection. Only display when detected.
This commit is contained in:
		
							parent
							
								
									a2a6ce24dd
								
							
						
					
					
						commit
						b884d590b3
					
				@ -90,7 +90,7 @@
 | 
			
		||||
              <tbody>
 | 
			
		||||
                <tr>
 | 
			
		||||
                  <td class="td-width" i18n="transaction.version">Version</td>
 | 
			
		||||
                  <td>{{ block.version | decimal2hex }} <span *ngIf="block.height > 681407" class="badge ml-1" [ngClass]="{'badge-success': hasTaproot(block.version), 'badge-danger': !hasTaproot(block.version) }">Taproot</span></td>
 | 
			
		||||
                  <td>{{ block.version | decimal2hex }} <span *ngIf="displayTaprootStatus() && hasTaproot(block.version)" class="badge badge-success ml-1" >Taproot</span></td>
 | 
			
		||||
                </tr>
 | 
			
		||||
                <tr>
 | 
			
		||||
                  <td i18n="block.merkle-root">Merkle root</td>
 | 
			
		||||
 | 
			
		||||
@ -204,6 +204,14 @@ export class BlockComponent implements OnInit, OnDestroy {
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  hasTaproot(version: number): boolean {
 | 
			
		||||
    return (Number(version) & (1 << 2)) > 0;
 | 
			
		||||
    const versionBit = 2; // Taproot
 | 
			
		||||
    return (Number(version) & (1 << versionBit)) === (1 << versionBit);
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  displayTaprootStatus(): boolean {
 | 
			
		||||
    if (this.stateService.network !== '') {
 | 
			
		||||
      return false;
 | 
			
		||||
    }
 | 
			
		||||
    return this.block && this.block.height > 681407 && (new Date().getTime() / 1000) < 1628640000;
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user