From 88e48df8a9c32ac5ccb3090ed94552aa0c8ad29e Mon Sep 17 00:00:00 2001 From: softsimon Date: Wed, 10 Nov 2021 15:05:45 +0400 Subject: [PATCH] Adding Taproot transaction tag fixes #914 --- frontend/src/app/bitcoin.utils.ts | 2 ++ .../src/app/components/tx-features/tx-features.component.html | 1 + .../src/app/components/tx-features/tx-features.component.ts | 2 ++ 3 files changed, 5 insertions(+) diff --git a/frontend/src/app/bitcoin.utils.ts b/frontend/src/app/bitcoin.utils.ts index b3c76dc31..577249940 100644 --- a/frontend/src/app/bitcoin.utils.ts +++ b/frontend/src/app/bitcoin.utils.ts @@ -16,6 +16,7 @@ export function calcSegwitFeeGains(tx: Transaction) { const isP2sh = vin.prevout.scriptpubkey_type === 'p2sh'; const isP2wsh = vin.prevout.scriptpubkey_type === 'v0_p2wsh'; const isP2wpkh = vin.prevout.scriptpubkey_type === 'v0_p2wpkh'; + const isP2tr = vin.prevout.scriptpubkey_type === 'v1_p2tr'; const op = vin.scriptsig ? vin.scriptsig_asm.split(' ')[0] : null; const isP2sh2Wpkh = isP2sh && !!vin.witness && op === 'OP_PUSHBYTES_22'; @@ -25,6 +26,7 @@ export function calcSegwitFeeGains(tx: Transaction) { // Native Segwit - P2WPKH/P2WSH (Bech32) case isP2wpkh: case isP2wsh: + case isP2tr: // maximal gains: the scriptSig is moved entirely to the witness part realizedGains += witnessSize(vin) * 3; // XXX P2WSH output creation is more expensive, should we take this into consideration? diff --git a/frontend/src/app/components/tx-features/tx-features.component.html b/frontend/src/app/components/tx-features/tx-features.component.html index ff3340f2c..46856a7c7 100644 --- a/frontend/src/app/components/tx-features/tx-features.component.html +++ b/frontend/src/app/components/tx-features/tx-features.component.html @@ -5,5 +5,6 @@ SegWit +Taproot RBF RBF diff --git a/frontend/src/app/components/tx-features/tx-features.component.ts b/frontend/src/app/components/tx-features/tx-features.component.ts index 4136907ee..08aba51e1 100644 --- a/frontend/src/app/components/tx-features/tx-features.component.ts +++ b/frontend/src/app/components/tx-features/tx-features.component.ts @@ -17,6 +17,7 @@ export class TxFeaturesComponent implements OnChanges { potentialP2shGains: 0, }; isRbfTransaction: boolean; + isTaproot: boolean; constructor() { } @@ -26,5 +27,6 @@ export class TxFeaturesComponent implements OnChanges { } this.segwitGains = calcSegwitFeeGains(this.tx); this.isRbfTransaction = this.tx.vin.some((v) => v.sequence < 0xfffffffe); + this.isTaproot = this.tx.vin.some((v) => v.prevout && v.prevout.scriptpubkey_type === 'v1_p2tr'); } }