Skip to content

Commit

Permalink
Interpreter: catch thrown exception and return false
Browse files Browse the repository at this point in the history
  • Loading branch information
afk11 committed Dec 10, 2019
1 parent 41537d3 commit 7fb73f8
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/Script/Interpreter/Interpreter.php
Original file line number Diff line number Diff line change
Expand Up @@ -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());
Expand Down

0 comments on commit 7fb73f8

Please sign in to comment.