示例#1
0
 async def on_connect(self, peer: WSChiaConnection):
     # Sends a handshake to the harvester
     handshake = harvester_protocol.HarvesterHandshake(
         self.get_public_keys(),
         self.pool_public_keys,
     )
     if peer.connection_type is NodeType.HARVESTER:
         msg = make_msg(ProtocolMessageTypes.harvester_handshake, handshake)
         await peer.send_message(msg)
示例#2
0
        async def handshake_task():
            # Wait until the task in `Farmer._start` is done so that we have keys available for the handshake. Bail out
            # early if we need to shut down or if the harvester is not longer connected.
            while not self.started and not self._shut_down and peer in self.server.get_connections():
                await asyncio.sleep(1)

            if self._shut_down:
                log.debug("handshake_task: shutdown")
                self.harvester_handshake_task = None
                return

            if peer not in self.server.get_connections():
                log.debug("handshake_task: disconnected")
                self.harvester_handshake_task = None
                return

            # Sends a handshake to the harvester
            handshake = harvester_protocol.HarvesterHandshake(
                self.get_public_keys(),
                self.pool_public_keys,
            )
            msg = make_msg(ProtocolMessageTypes.harvester_handshake, handshake)
            await peer.send_message(msg)
            self.harvester_handshake_task = None
pool_difficulty = harvester_protocol.PoolDifficulty(
    uint64(14819251421858580996),
    uint64(12852879676624401630),
    bytes32(
        bytes.fromhex(
            "c9423123ea65e6923e973b95531b4874570dae942cb757a2daec4a6971753886")
    ),
)

harvester_handhsake = harvester_protocol.HarvesterHandshake(
    [
        G1Element(
            bytes.fromhex(
                "a04c6b5ac7dfb935f6feecfdd72348ccf1d4be4fe7e26acf271ea3b7d308da61e0a308f7a62495328a81f5147b66634c"
            ), ),
    ],
    [
        G1Element(
            bytes.fromhex(
                "a04c6b5ac7dfb935f6feecfdd72348ccf1d4be4fe7e26acf271ea3b7d308da61e0a308f7a62495328a81f5147b66634c"
            ), ),
    ],
)

new_signage_point_harvester = harvester_protocol.NewSignagePointHarvester(
    bytes32(
        bytes.fromhex(
            "e342c21b4aeaa52349d42492be934692db58494ca9bce4a8697d06fdf8e583bb")
    ),
    uint64(15615706268399948682),
    uint64(10520767421667792980),
    uint8(148),