コード例 #1
0
 public function testNetworkSerializer()
 {
     $array = [new Inventory(Inventory::MSG_TX, Buffer::hex('4141414141414141414141414141414141414141414141414141414141414141')), new Inventory(Inventory::MSG_TX, Buffer::hex('4141414141414141414141414141414141414141414141414141414141414142')), new Inventory(Inventory::MSG_TX, Buffer::hex('4141414141414141414141414141414141414141414141414141414141414143'))];
     $not = new NotFound($array);
     $serializer = new NetworkMessageSerializer(Bitcoin::getDefaultNetwork());
     $serialized = $not->getNetworkMessage()->getBuffer();
     $parsed = $serializer->parse($serialized)->getPayload();
     $this->assertEquals($not, $parsed);
 }
コード例 #2
0
 /**
  * @param NotFound $notFound
  * @return \BitWasp\Buffertools\Buffer
  */
 public function serialize(NotFound $notFound)
 {
     return $this->getTemplate()->write([$notFound->getItems()]);
 }