1 | <?php |
||
22 | class Checker |
||
23 | { |
||
24 | /** |
||
25 | * @var EcAdapterInterface |
||
26 | */ |
||
27 | private $adapter; |
||
28 | |||
29 | /** |
||
30 | * @var TransactionInterface |
||
31 | */ |
||
32 | private $transaction; |
||
33 | |||
34 | /** |
||
35 | * @var int |
||
36 | */ |
||
37 | private $nInput; |
||
38 | |||
39 | /** |
||
40 | * @var int|string |
||
41 | */ |
||
42 | private $amount; |
||
43 | |||
44 | /** |
||
45 | * Checker constructor. |
||
46 | * @param EcAdapterInterface $ecAdapter |
||
47 | * @param TransactionInterface $transaction |
||
48 | * @param int $nInput |
||
49 | * @param int|string $amount |
||
50 | */ |
||
51 | public function __construct(EcAdapterInterface $ecAdapter, TransactionInterface $transaction, $nInput, $amount) |
||
58 | |||
59 | /** |
||
60 | * @param BufferInterface $signature |
||
61 | * @return bool |
||
62 | */ |
||
63 | public function isValidSignatureEncoding(BufferInterface $signature) |
||
74 | |||
75 | /** |
||
76 | * @param BufferInterface $signature |
||
77 | * @return bool |
||
78 | * @throws ScriptRuntimeException |
||
79 | * @throws \Exception |
||
80 | */ |
||
81 | public function isLowDerSignature(BufferInterface $signature) |
||
94 | |||
95 | /** |
||
96 | * Determine whether the sighash byte appended to the signature encodes |
||
97 | * a valid sighash type. |
||
98 | * |
||
99 | * @param BufferInterface $signature |
||
100 | * @return bool |
||
101 | */ |
||
102 | public function isDefinedHashtypeSignature(BufferInterface $signature) |
||
114 | |||
115 | /** |
||
116 | * @param BufferInterface $signature |
||
117 | * @param int $flags |
||
118 | * @return $this |
||
119 | * @throws \BitWasp\Bitcoin\Exceptions\ScriptRuntimeException |
||
120 | */ |
||
121 | public function checkSignatureEncoding(BufferInterface $signature, $flags) |
||
137 | |||
138 | /** |
||
139 | * @param BufferInterface $publicKey |
||
140 | * @param int $flags |
||
141 | * @return $this |
||
142 | * @throws \Exception |
||
143 | */ |
||
144 | public function checkPublicKeyEncoding(BufferInterface $publicKey, $flags) |
||
152 | |||
153 | /** |
||
154 | * @param ScriptInterface $script |
||
155 | * @param BufferInterface $sigBuf |
||
156 | * @param BufferInterface $keyBuf |
||
157 | * @param int $sigVersion |
||
158 | * @param int $flags |
||
159 | * @return bool |
||
160 | * @throws ScriptRuntimeException |
||
161 | */ |
||
162 | public function checkSig(ScriptInterface $script, BufferInterface $sigBuf, BufferInterface $keyBuf, $sigVersion, $flags) |
||
185 | |||
186 | /** |
||
187 | * @param int $txLockTime |
||
188 | * @param int $nThreshold |
||
189 | * @param \BitWasp\Bitcoin\Script\Interpreter\Number $lockTime |
||
190 | * @return bool |
||
191 | */ |
||
192 | private function verifyLockTime($txLockTime, $nThreshold, \BitWasp\Bitcoin\Script\Interpreter\Number $lockTime) |
||
204 | |||
205 | /** |
||
206 | * @param \BitWasp\Bitcoin\Script\Interpreter\Number $lockTime |
||
207 | * @return bool |
||
208 | */ |
||
209 | public function checkLockTime(\BitWasp\Bitcoin\Script\Interpreter\Number $lockTime) |
||
217 | |||
218 | |||
219 | /** |
||
220 | * @param \BitWasp\Bitcoin\Script\Interpreter\Number $sequence |
||
221 | * @return bool |
||
222 | */ |
||
223 | public function checkSequence(\BitWasp\Bitcoin\Script\Interpreter\Number $sequence) |
||
242 | } |
||
243 |