Fix goggles inscription detection bug
This commit is contained in:
		
							parent
							
								
									73d4ea75de
								
							
						
					
					
						commit
						00b8f001b0
					
				@ -263,8 +263,13 @@ export class Common {
 | 
			
		||||
        case 'v0_p2wsh': flags |= TransactionFlags.p2wsh; break;
 | 
			
		||||
        case 'v1_p2tr': {
 | 
			
		||||
          flags |= TransactionFlags.p2tr;
 | 
			
		||||
          if (vin.witness.length > 2) {
 | 
			
		||||
            const asm = vin.inner_witnessscript_asm || transactionUtils.convertScriptSigAsm(vin.witness[vin.witness.length - 2]);
 | 
			
		||||
          // in taproot, if the last witness item begins with 0x50, it's an annex
 | 
			
		||||
          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')) {
 | 
			
		||||
              flags |= TransactionFlags.inscription;
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user