Пример #1
0
 public function testLookup()
 {
     $hash = str_pad("", 32, "");
     $buffer = new Buffer($hash);
     $height = 0;
     $cache = new ChainCache([$hash]);
     try {
         $lookup = $cache->getHash($height);
         $this->assertEquals($hash, $lookup->getBinary());
         $this->assertEquals($height, $cache->getHeight($buffer));
         $result = true;
     } catch (\Exception $e) {
         $result = false;
     }
     $this->assertTrue($result, 'cache item exists');
 }
Пример #2
0
 /**
  * @param Buffer $hash
  * @return int
  */
 public function getHeightFromHash(Buffer $hash)
 {
     return $this->chainCache->getHeight($hash);
 }