/**
  * @param Parser $parser
  * @return \BitWasp\Bitcoin\Block\Block
  * @throws \BitWasp\Buffertools\Exceptions\ParserOutOfRange
  */
 public function fromParser(Parser &$parser)
 {
     list($bytes, $blockSize) = $this->getHeaderTemplate()->parse($parser);
     if ($bytes->getHex() !== $this->network->getNetMagicBytes()) {
         throw new \RuntimeException('Block version bytes did not match network');
     }
     return $this->blockSerializer->fromParser(new Parser($parser->readBytes($blockSize)));
 }