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
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)
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)