/**
  * @return \BitWasp\Buffertools\Template
  */
 public function getTemplate()
 {
     return (new TemplateFactory())->vector(function (Parser $parser) {
         $header = $this->header->fromParser($parser);
         $parser->readBytes(1);
         return $header;
     })->getTemplate();
 }
Exemplo n.º 2
0
 /**
  * @param BlockInterface $block
  * @return \BitWasp\Buffertools\Buffer
  */
 public function serialize(BlockInterface $block)
 {
     return Buffertools::concat($this->headerSerializer->serialize($block->getHeader()), $this->getTxsTemplate()->write([$block->getTransactions()->all()]));
 }
 /**
  * @param FilteredBlock $merkleBlock
  * @return \BitWasp\Buffertools\BufferInterface
  */
 public function serialize(FilteredBlock $merkleBlock)
 {
     return Buffertools::concat($this->headerSerializer->serialize($merkleBlock->getHeader()), $this->treeSerializer->serialize($merkleBlock->getPartialTree()));
 }