Skip to content

Commit

Permalink
witness limit initial stack size
Browse files Browse the repository at this point in the history
  • Loading branch information
afk11 committed Nov 9, 2019
1 parent 2701901 commit 5ee69f0
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 1 deletion.
3 changes: 2 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@
},
"files": [
"src/Script/functions.php",
"src/Script/sighash_functions.php"
"src/Script/sighash_functions.php",
"src/Script/script_constants.php"
]
},
"autoload-dev": {
Expand Down
3 changes: 3 additions & 0 deletions src/Script/Interpreter/Interpreter.php
Original file line number Diff line number Diff line change
Expand Up @@ -223,6 +223,9 @@ private function executeWitnessProgram(ScriptWitnessInterface $witness, ScriptIn

$mainStack = new Stack();
foreach ($witness as $value) {
if ($value->getSize() > self::MAX_SCRIPT_ELEMENT_SIZE) {
return false;
}
$mainStack->push($value);
}

Expand Down
4 changes: 4 additions & 0 deletions src/Script/script_constants.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<?php


const VALIDATION_WEIGHT_OFFSET = 50;

0 comments on commit 5ee69f0

Please sign in to comment.