mirror of
https://github.com/mempool/mempool.git
synced 2025-01-19 05:34:03 +01:00
Improve taproot detection. Only display when detected.
This commit is contained in:
parent
0b4da88802
commit
72d01a0b67
@ -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…
Reference in New Issue
Block a user