1 | <?php |
||
12 | class V1Hasher |
||
13 | { |
||
14 | /** |
||
15 | * @var TransactionInterface |
||
16 | */ |
||
17 | private $transaction; |
||
18 | |||
19 | /** |
||
20 | * @var int|string |
||
21 | */ |
||
22 | private $amount; |
||
23 | |||
24 | /** |
||
25 | * V1Hasher constructor. |
||
26 | * @param TransactionInterface $transaction |
||
27 | * @param int|string $amount |
||
28 | */ |
||
29 | 30 | public function __construct(TransactionInterface $transaction, $amount) |
|
34 | |||
35 | /** |
||
36 | * @param int $sighashType |
||
37 | * @return Buffer|BufferInterface |
||
38 | */ |
||
39 | 30 | public function hashPrevOuts($sighashType) |
|
51 | |||
52 | /** |
||
53 | * @param int $sighashType |
||
54 | * @return Buffer|BufferInterface |
||
55 | */ |
||
56 | 30 | public function hashSequences($sighashType) |
|
68 | |||
69 | /** |
||
70 | * @param int $sighashType |
||
71 | * @param int $inputToSign |
||
72 | * @return Buffer|BufferInterface |
||
73 | */ |
||
74 | 30 | public function hashOutputs($sighashType, $inputToSign) |
|
88 | |||
89 | /** |
||
90 | * Calculate the hash of the current transaction, when you are looking to |
||
91 | * spend $txOut, and are signing $inputToSign. The SigHashType defaults to |
||
92 | * SIGHASH_ALL, though SIGHASH_SINGLE, SIGHASH_NONE, SIGHASH_ANYONECANPAY |
||
93 | * can be used. |
||
94 | * |
||
95 | * @param ScriptInterface $txOutScript |
||
96 | * @param int $inputToSign |
||
97 | * @param int $sighashType |
||
98 | * @return BufferInterface |
||
99 | * @throws \Exception |
||
100 | */ |
||
101 | 30 | public function calculate(ScriptInterface $txOutScript, $inputToSign, $sighashType = SigHashInterface::ALL) |
|
124 | } |
||
125 |