Skip to content

Commit

Permalink
Hash cache fix
Browse files Browse the repository at this point in the history
  • Loading branch information
romanzaycev committed May 22, 2024
1 parent 1a56333 commit bc9e9a0
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
4 changes: 3 additions & 1 deletion src/Olifanton/Interop/Boc/Cell.php
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,9 @@ public function hash(): Uint8Array
}

try {
return Crypto::sha256($this->getRepr());
$this->_hash = Crypto::sha256($this->getRepr());

return $this->_hash;
// @codeCoverageIgnoreStart
} catch (CryptoException $e) {
throw new CellException("SHA256 digest error: " . $e->getMessage(), $e->getCode(), $e);
Expand Down
4 changes: 2 additions & 2 deletions tests/Olifanton/Interop/Tests/Boc/HashmapTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -310,8 +310,8 @@ public function testComplexCreateAndParse(): void
foreach ($dict as $k => $_) {
/** @noinspection PhpUnpackedArgumentTypeMismatchInspection */
$this->assertEquals(
$dict->get($k),
$result->get($k),
$dict->get($k)->hash(),
$result->get($k)->hash(),
sprintf("Key: [ %d, %d ]", ...$k),
);
}
Expand Down

0 comments on commit bc9e9a0

Please sign in to comment.