Пример #1
0
 /**
  * @param BlockIndexInterface $index
  * @return bool
  */
 public function isNext(BlockIndexInterface $index)
 {
     if (false === $this->hash->equals($index->getHeader()->getPrevBlock())) {
         return false;
     }
     if (false === ($index->getHeight() == $this->height + 1)) {
         return false;
     }
     return true;
 }
Пример #2
0
 /**
  * @param BufferInterface $hash
  * @return bool|ChainView
  */
 public function isTip(BufferInterface $hash)
 {
     foreach ($this->segments as $segment) {
         if ($hash->equals($segment->getLast()->getHash())) {
             return $this->view($segment);
         }
     }
     return false;
 }