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