Conditions | 3 |
Paths | 3 |
Total Lines | 15 |
Code Lines | 9 |
Lines | 0 |
Ratio | 0 % |
Tests | 8 |
CRAP Score | 3 |
Changes | 0 |
1 | <?php |
||
20 | 477 | public function verify(TransactionInterface $tx, ScriptInterface $scriptPubKey, $flags, $nInputToSign, $amount) |
|
21 | { |
||
22 | 477 | if ($flags !== ($flags & BITCOINCONSENSUS_VERIFY_ALL)) { |
|
23 | 1 | throw new BitcoinConsensusException("Invalid flags for bitcoinconsensus"); |
|
24 | } |
||
25 | |||
26 | 476 | $error = 0; |
|
27 | 476 | if ($flags & InterpreterInterface::VERIFY_WITNESS) { |
|
28 | 140 | $verify = (bool) bitcoinconsensus_verify_script_with_amount($scriptPubKey->getBinary(), $amount, $tx->getBinary(), $nInputToSign, $flags, $error); |
|
29 | } else { |
||
30 | 336 | $verify = (bool) bitcoinconsensus_verify_script($scriptPubKey->getBinary(), $tx->getBaseSerialization()->getBinary(), $nInputToSign, $flags, $error); |
|
31 | } |
||
32 | |||
33 | 476 | return $verify; |
|
34 | } |
||
35 | } |
||
36 |