/**
  * @param PeerState $state
  * @param Peer $peer
  * @param GetHeaders $getHeaders
  */
 public function onGetHeaders(PeerState $state, Peer $peer, GetHeaders $getHeaders)
 {
     return;
     $chain = $this->node->chain();
     if ($chain->getIndex()->getHeader()->getTimestamp() >= time() - 60 * 60 * 24) {
         $locator = $getHeaders->getLocator();
         if (count($locator->getHashes()) === 0) {
             $start = $locator->getHashStop();
         } else {
             $start = $this->db->findFork($chain, $locator);
         }
         $headers = $this->db->fetchNextHeaders($start);
         $peer->headers($headers);
         $this->debug->log('peer.sentheaders', ['count' => count($headers), 'start' => $start->getHex()]);
     }
 }
Example #2
0
 /**
  * @param BufferInterface $hash
  * @return \BitWasp\Bitcoin\Block\BlockHeaderInterface[]
  */
 public function fetchNextHeaders(BufferInterface $hash)
 {
     echo __FUNCTION__ . PHP_EOL;
     return $this->db->fetchNextHeaders($hash);
 }