| Conditions | 3 |
| Paths | 3 |
| Total Lines | 18 |
| Code Lines | 12 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 10 |
| CRAP Score | 3 |
| Changes | 0 | ||
| 1 | <?php |
||
| 27 | 330 | public function getSigHash(ScriptInterface $script, int $sigHashType, int $sigVersion): BufferInterface |
|
| 28 | { |
||
| 29 | 330 | $cacheCheck = $sigVersion . $sigHashType . $script->getBuffer()->getBinary(); |
|
| 30 | 330 | if (!isset($this->sigHashCache[$cacheCheck])) { |
|
| 31 | 330 | if (SigHash::V1 === $sigVersion) { |
|
| 32 | 82 | $hasher = new V1Hasher($this->transaction, $this->amount); |
|
| 33 | } else { |
||
| 34 | 250 | $hasher = new Hasher($this->transaction); |
|
| 35 | } |
||
| 36 | |||
| 37 | 330 | $hash = $hasher->calculate($script, $this->nInput, $sigHashType); |
|
| 38 | 330 | $this->sigHashCache[$cacheCheck] = $hash->getBinary(); |
|
| 39 | } else { |
||
| 40 | 46 | $hash = new Buffer($this->sigHashCache[$cacheCheck], 32); |
|
| 41 | } |
||
| 42 | |||
| 43 | 330 | return $hash; |
|
| 44 | } |
||
| 45 | } |
||
| 46 |