name tapscript by its name + OP_CHECKSIGADD tapscript opcode detection

This commit is contained in:
Antoni Spaanderman 2022-04-04 17:16:34 +02:00
parent 096f2172c6
commit 53d68a3571
No known key found for this signature in database
GPG Key ID: AE0B68E552E5DF8C
3 changed files with 25 additions and 15 deletions

View File

@ -326,21 +326,27 @@ class BitcoinApi implements AbstractBitcoinApi {
b.push(data.toString('hex'));
i += data.length;
} else {
const opcode = bitcoinjs.script.toASM([ op ]);
if (opcode && op < 0xfd) {
if (op === 0x4f) {
b.push('OP_PUSHNUM_NEG1');
} else if (/^OP_(\d+)$/.test(opcode) && op !== 0x00) {
b.push(opcode.replace(/^OP_(\d+)$/, 'OP_PUSHNUM_$1'));
} else if (op === 0xb1) {
b.push('OP_CLTV');
} else if (op === 0xb2) {
b.push('OP_CSV');
} else {
b.push(opcode);
}
if (op === 0x00) {
b.push('OP_0');
} else if (op === 0x4f) {
b.push('OP_PUSHNUM_NEG1');
} else if (op === 0xb1) {
b.push('OP_CLTV');
} else if (op === 0xb2) {
b.push('OP_CSV');
} else if (op === 0xba) {
b.push('OP_CHECKSIGADD');
} else {
b.push('OP_RETURN_' + op);
const opcode = bitcoinjs.script.toASM([ op ]);
if (opcode && op < 0xfd) {
if (/^OP_(\d+)$/.test(opcode)) {
b.push(opcode.replace(/^OP_(\d+)$/, 'OP_PUSHNUM_$1'));
} else {
b.push(opcode);
}
} else {
b.push('OP_RETURN_' + op);
}
}
i += 1;
}

View File

@ -111,7 +111,10 @@
<td style="text-align: left;" [innerHTML]="vin.inner_redeemscript_asm | asmStyler"></td>
</tr>
<tr *ngIf="vin.inner_witnessscript_asm">
<td i18n="transactions-list.p2wsh-witness-script">P2WSH witness script</td>
<td *ngIf="vin.prevout && vin.prevout.scriptpubkey_type == 'v1_p2tr'; else p2wsh" i18n="transactions-list.p2tr-tapscript">P2TR tapscript</td>
<ng-template #p2wsh>
<td i18n="transactions-list.p2wsh-witness-script">P2WSH witness script</td>
</ng-template>
<td style="text-align: left;" [innerHTML]="vin.inner_witnessscript_asm | asmStyler"></td>
</tr>
<tr>

View File

@ -281,6 +281,7 @@ export class AsmStylerPipe implements PipeTransform {
case 'CHECKSIGVERIFY':
case 'CHECKMULTISIG':
case 'CHECKMULTISIGVERIFY':
case 'CHECKSIGADD':
style = 'crypto';
break;