diff --git a/src/Script/Interpreter/Interpreter.php b/src/Script/Interpreter/Interpreter.php index 1a840b90f..4d35454b7 100644 --- a/src/Script/Interpreter/Interpreter.php +++ b/src/Script/Interpreter/Interpreter.php @@ -173,8 +173,12 @@ private function verifyTaprootCommitment(BufferInterface $control, BufferInterfa $p = $control->slice(1, 32); /** @var XOnlyPublicKeySerializerInterface $xonlySer */ $xonlySer = EcSerializer::getSerializer(XOnlyPublicKeySerializerInterface::class, true, $this->adapter); - $P = $xonlySer->parse($p); - $Q = $xonlySer->parse($program); + try { + $P = $xonlySer->parse($p); + $Q = $xonlySer->parse($program); + } catch (\Exception $e) { + return false; + } $leafVersion = $control->slice(0, 1)->getInt() & TAPROOT_LEAF_MASK; $leafData = new Buffer(chr($leafVersion&TAPROOT_LEAF_MASK) . Buffertools::numToVarIntBin($scriptPubKey->getSize()) . $scriptPubKey->getBinary());