Пример #1
0
 def test_block_payload(self):
     blk = FakeBlock()
     blk_bytes = blk.pack()
     unpacked = blk.serializer.ez_unpack_serializables([BlockPayload],
                                                       blk_bytes)
     blk2 = BamiBlock.from_payload(unpacked[0])
     assert blk2 == blk
Пример #2
0
 def received_block_broadcast(self, peer: Peer,
                              payload: BlockBroadcastPayload):
     block = BamiBlock.from_payload(payload, self.serializer)
     self.validate_persist_block(block, peer)
     self.process_broadcast_block(block, payload.ttl)
Пример #3
0
 def received_block(self, peer: Peer, payload: BlockPayload):
     block = BamiBlock.from_payload(payload, self.serializer)
     self.logger.debug("Received block from push gossip %s from peer %s",
                       block.com_dot, peer)
     self.validate_persist_block(block, peer)