Completed
Pull Request — master (#339)
by thomas
105:25 queued 102:16
created

BitcoinConsensus   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 23
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Test Coverage

Coverage 0%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 23
ccs 0
cts 11
cp 0
rs 10
wmc 1
lcom 0
cbo 2

1 Method

Rating   Name   Duplication   Size   Complexity  
A verify() 0 11 1
1
<?php
2
3
namespace BitWasp\Bitcoin\Script\Consensus;
4
5
use BitWasp\Bitcoin\Script\ScriptInterface;
6
use BitWasp\Bitcoin\Script\ScriptWitnessInterface;
7
use BitWasp\Bitcoin\Transaction\TransactionInterface;
8
9
class BitcoinConsensus implements ConsensusInterface
10
{
11
    /**
12
     * @param TransactionInterface $tx
13
     * @param ScriptInterface $scriptPubKey
14
     * @param int $nInputToSign
15
     * @param int $flags
16
     * @param int $amount
17
     * @param ScriptWitnessInterface|null $witness
18
     * @return bool
19
     */
20
    public function verify(TransactionInterface $tx, ScriptInterface $scriptPubKey, $flags, $nInputToSign, $amount, ScriptWitnessInterface $witness = null)
21
    {
22
        $error = 0;
23
        return (bool) bitcoinconsensus_verify_script(
24
            $scriptPubKey->getBinary(),
25
            $tx->getBinary(),
26
            $nInputToSign,
27
            $flags,
28
            $error
29
        );
30
    }
31
}
32