mirror of
https://github.com/mempool/mempool.git
synced 2025-02-22 22:25:34 +01:00
Merge pull request #4583 from mempool/mononaut/goggles-inscription-bug
Fix goggles inscription detection bug
This commit is contained in:
commit
91fad7ff65
1 changed files with 7 additions and 2 deletions
|
@ -263,8 +263,13 @@ export class Common {
|
||||||
case 'v0_p2wsh': flags |= TransactionFlags.p2wsh; break;
|
case 'v0_p2wsh': flags |= TransactionFlags.p2wsh; break;
|
||||||
case 'v1_p2tr': {
|
case 'v1_p2tr': {
|
||||||
flags |= TransactionFlags.p2tr;
|
flags |= TransactionFlags.p2tr;
|
||||||
if (vin.witness.length > 2) {
|
// in taproot, if the last witness item begins with 0x50, it's an annex
|
||||||
const asm = vin.inner_witnessscript_asm || transactionUtils.convertScriptSigAsm(vin.witness[vin.witness.length - 2]);
|
const hasAnnex = vin.witness?.[vin.witness.length - 1].startsWith('50');
|
||||||
|
// script spends have more than one witness item, not counting the annex (if present)
|
||||||
|
if (vin.witness.length > (hasAnnex ? 2 : 1)) {
|
||||||
|
// the script itself is the second-to-last witness item, not counting the annex
|
||||||
|
const asm = vin.inner_witnessscript_asm || transactionUtils.convertScriptSigAsm(vin.witness[vin.witness.length - (hasAnnex ? 3 : 2)]);
|
||||||
|
// inscriptions smuggle data within an 'OP_0 OP_IF ... OP_ENDIF' envelope
|
||||||
if (asm?.includes('OP_0 OP_IF')) {
|
if (asm?.includes('OP_0 OP_IF')) {
|
||||||
flags |= TransactionFlags.inscription;
|
flags |= TransactionFlags.inscription;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue