示例#1
0
 /**
  * @param HeaderChainViewInterface $headersView
  * @param BlockIndexInterface $index
  * @return Forks
  */
 public function prepareForks(HeaderChainViewInterface $headersView, BlockIndexInterface $index)
 {
     if ($this->forks instanceof Forks && $this->forks->isNext($index)) {
         $forks = $this->forks;
     } else {
         $versionInfo = $this->db->findSuperMajorityInfoByHash($index->getHeader()->getPrevBlock());
         $forks = $this->forks = new Forks($this->consensus->getParams(), $headersView->getLastBlock(), $versionInfo);
     }
     return $forks;
 }
示例#2
0
 /**
  * @param BufferInterface $hash
  * @param int $numAncestors
  * @return array
  */
 public function findSuperMajorityInfoByHash(BufferInterface $hash, $numAncestors = 1000)
 {
     echo __FUNCTION__ . PHP_EOL;
     return $this->db->findSuperMajorityInfoByHash($hash, $numAncestors);
 }