1 | <?php |
||
12 | class V1Hasher |
||
13 | { |
||
14 | /** |
||
15 | * @var TransactionInterface |
||
16 | */ |
||
17 | private $transaction; |
||
18 | |||
19 | /** |
||
20 | * @var int |
||
21 | */ |
||
22 | private $nInputs; |
||
23 | |||
24 | /** |
||
25 | * @var int |
||
26 | */ |
||
27 | private $nOutputs; |
||
28 | |||
29 | /** |
||
30 | * @var int|string |
||
31 | */ |
||
32 | private $amount; |
||
33 | |||
34 | /** |
||
35 | * V1Hasher constructor. |
||
36 | * @param TransactionInterface $transaction |
||
37 | * @param int|string $amount |
||
38 | */ |
||
39 | 30 | public function __construct(TransactionInterface $transaction, $amount) |
|
46 | |||
47 | /** |
||
48 | * @param int $sighashType |
||
49 | * @return Buffer|BufferInterface |
||
50 | */ |
||
51 | 30 | public function hashPrevOuts($sighashType) |
|
63 | |||
64 | /** |
||
65 | * @param int $sighashType |
||
66 | * @return Buffer|BufferInterface |
||
67 | */ |
||
68 | 30 | public function hashSequences($sighashType) |
|
80 | |||
81 | /** |
||
82 | * @param int $sighashType |
||
83 | * @param int $inputToSign |
||
84 | * @return Buffer|BufferInterface |
||
85 | */ |
||
86 | 30 | public function hashOutputs($sighashType, $inputToSign) |
|
100 | |||
101 | /** |
||
102 | * Calculate the hash of the current transaction, when you are looking to |
||
103 | * spend $txOut, and are signing $inputToSign. The SigHashType defaults to |
||
104 | * SIGHASH_ALL, though SIGHASH_SINGLE, SIGHASH_NONE, SIGHASH_ANYONECANPAY |
||
105 | * can be used. |
||
106 | * |
||
107 | * @param ScriptInterface $txOutScript |
||
108 | * @param int $inputToSign |
||
109 | * @param int $sighashType |
||
110 | * @return BufferInterface |
||
111 | * @throws \Exception |
||
112 | */ |
||
113 | 30 | public function calculate(ScriptInterface $txOutScript, $inputToSign, $sighashType = SigHash::ALL) |
|
136 | } |
||
137 |