Skip to content

Commit

Permalink
tapscript execution: require MINIMALIF in tapscript
Browse files Browse the repository at this point in the history
  • Loading branch information
afk11 committed Nov 11, 2019
1 parent 99843c2 commit bb1571b
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/Script/Interpreter/Interpreter.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
use BitWasp\Bitcoin\Exceptions\ScriptRuntimeException;
use BitWasp\Bitcoin\Exceptions\SignatureNotCanonical;
use BitWasp\Bitcoin\Script\Classifier\OutputClassifier;
use BitWasp\Bitcoin\Script\Interpreter\ExecutionContext;
use BitWasp\Bitcoin\Script\Opcodes;
use BitWasp\Bitcoin\Script\Script;
use BitWasp\Bitcoin\Script\ScriptFactory;
Expand Down Expand Up @@ -708,7 +707,8 @@ public function evaluate(ScriptInterface $script, Stack $mainStack, int $sigVers
}
$vch = $mainStack[-1];

if ($sigVersion === SigHash::V1 && ($flags & self::VERIFY_MINIMALIF)) {
// minimalif is a standardness rule in v0 segwit, but required in tapscript
if ($sigVersion === SigHash::TAPSCRIPT || ($sigVersion === SigHash::V1 && ($flags & self::VERIFY_MINIMALIF))) {
if ($vch->getSize() > 1) {
throw new ScriptRuntimeException(self::VERIFY_MINIMALIF, 'Input to OP_IF/NOTIF should be minimally encoded');
}
Expand Down

0 comments on commit bb1571b

Please sign in to comment.