Skip to content

Commit 7fb73f8

Browse files
committed
Interpreter: catch thrown exception and return false
1 parent 41537d3 commit 7fb73f8

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

src/Script/Interpreter/Interpreter.php

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -173,8 +173,12 @@ private function verifyTaprootCommitment(BufferInterface $control, BufferInterfa
173173
$p = $control->slice(1, 32);
174174
/** @var XOnlyPublicKeySerializerInterface $xonlySer */
175175
$xonlySer = EcSerializer::getSerializer(XOnlyPublicKeySerializerInterface::class, true, $this->adapter);
176-
$P = $xonlySer->parse($p);
177-
$Q = $xonlySer->parse($program);
176+
try {
177+
$P = $xonlySer->parse($p);
178+
$Q = $xonlySer->parse($program);
179+
} catch (\Exception $e) {
180+
return false;
181+
}
178182
$leafVersion = $control->slice(0, 1)->getInt() & TAPROOT_LEAF_MASK;
179183

180184
$leafData = new Buffer(chr($leafVersion&TAPROOT_LEAF_MASK) . Buffertools::numToVarIntBin($scriptPubKey->getSize()) . $scriptPubKey->getBinary());

0 commit comments

Comments
 (0)