Example #1
0
 /**
  * @param HeadersBatch $batch
  * @return $this
  * @throws \Exception
  */
 public function applyBatch(HeadersBatch $batch)
 {
     $indices = $batch->getIndices();
     if (count($indices) === 0) {
         return $this;
     }
     $this->db->insertHeaderBatch($batch);
     $tip = $batch->getTip();
     foreach ($batch->getIndices() as $index) {
         $tip->updateTip($index);
     }
     $this->emit('tip', [$batch]);
     return $this;
 }
Example #2
0
 /**
  * @param HeadersBatch $batch
  * @return bool
  * @throws \Exception
  */
 public function insertHeaderBatch(HeadersBatch $batch)
 {
     echo __FUNCTION__ . PHP_EOL;
     return $this->db->insertHeaderBatch($batch);
 }