コード例 #1
0
 /**
  * @param PartialMerkleTree $tree
  * @return \BitWasp\Buffertools\Buffer
  */
 public function serialize(PartialMerkleTree $tree)
 {
     return $this->getTemplate()->write([$tree->getTxCount(), $tree->getHashes(), $this->bitsToBuffers($tree->getFlagBits())]);
 }
コード例 #2
0
ファイル: Block.php プロジェクト: sbwdlihao/bitcoin-php
 /**
  * @param BloomFilter $filter
  * @return FilteredBlock
  */
 public function filter(BloomFilter $filter)
 {
     $vMatch = [];
     $vHashes = [];
     foreach ($this->getTransactions() as $tx) {
         $vMatch[] = $filter->isRelevantAndUpdate($tx);
         $vHashes[] = $tx->getTxHash();
     }
     return new FilteredBlock($this->getHeader(), PartialMerkleTree::create(count($this->getTransactions()), $vHashes, $vMatch));
 }