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 | 441 | public function __construct(EcAdapterInterface $ecAdapter, TransactionInterface $transaction, $nInput, $amount) |
|
58 | |||
59 | /** |
||
60 | * @param BufferInterface $signature |
||
61 | * @return bool |
||
62 | */ |
||
63 | 27 | public function isValidSignatureEncoding(BufferInterface $signature) |
|
74 | |||
75 | /** |
||
76 | * @param BufferInterface $signature |
||
77 | * @return bool |
||
78 | * @throws ScriptRuntimeException |
||
79 | * @throws \Exception |
||
80 | */ |
||
81 | 15 | 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 | 18 | public function isDefinedHashtypeSignature(BufferInterface $signature) |
|
103 | { |
||
104 | 18 | if ($signature->getSize() === 0) { |
|
105 | 3 | return false; |
|
106 | } |
||
107 | |||
108 | 15 | $binary = $signature->getBinary(); |
|
109 | 15 | $nHashType = ord(substr($binary, -1)) & (~(SigHashInterface::ANYONECANPAY)); |
|
110 | |||
111 | 15 | return !(($nHashType < SigHashInterface::ALL) || ($nHashType > SigHashInterface::SINGLE)); |
|
112 | } |
||
113 | |||
114 | /** |
||
115 | * @param BufferInterface $signature |
||
116 | * @param int $flags |
||
117 | * @return $this |
||
118 | * @throws \BitWasp\Bitcoin\Exceptions\ScriptRuntimeException |
||
119 | */ |
||
120 | 60 | public function checkSignatureEncoding(BufferInterface $signature, $flags) |
|
136 | |||
137 | /** |
||
138 | * @param BufferInterface $publicKey |
||
139 | * @param int $flags |
||
140 | * @return $this |
||
141 | * @throws \Exception |
||
142 | */ |
||
143 | 42 | public function checkPublicKeyEncoding(BufferInterface $publicKey, $flags) |
|
151 | |||
152 | /** |
||
153 | * @param ScriptInterface $script |
||
154 | * @param BufferInterface $sigBuf |
||
155 | * @param BufferInterface $keyBuf |
||
156 | * @param int $sigVersion |
||
157 | * @param int $flags |
||
158 | * @return bool |
||
159 | * @throws ScriptRuntimeException |
||
160 | */ |
||
161 | 39 | public function checkSig(ScriptInterface $script, BufferInterface $sigBuf, BufferInterface $keyBuf, $sigVersion, $flags) |
|
183 | |||
184 | /** |
||
185 | * @param int $txLockTime |
||
186 | * @param int $nThreshold |
||
187 | * @param \BitWasp\Bitcoin\Script\Interpreter\Number $lockTime |
||
188 | * @return bool |
||
189 | */ |
||
190 | private function verifyLockTime($txLockTime, $nThreshold, \BitWasp\Bitcoin\Script\Interpreter\Number $lockTime) |
||
201 | |||
202 | /** |
||
203 | * @param \BitWasp\Bitcoin\Script\Interpreter\Number $lockTime |
||
204 | * @return bool |
||
205 | */ |
||
206 | public function checkLockTime(\BitWasp\Bitcoin\Script\Interpreter\Number $lockTime) |
||
214 | |||
215 | |||
216 | /** |
||
217 | * @param \BitWasp\Bitcoin\Script\Interpreter\Number $sequence |
||
218 | * @return bool |
||
219 | */ |
||
220 | public function checkSequence(\BitWasp\Bitcoin\Script\Interpreter\Number $sequence) |
||
239 | } |
||
240 |
It seems like the type of the argument is not accepted by the function/method which you are calling.
In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.
We suggest to add an explicit type cast like in the following example: