예제 #1
0
        void RespondToHello0(ICcpRemoteEndpoint clientEndpoint, ServerHello0Status status, byte[] cnonce0)
        {
            var response = new ServerHelloPacket0 {
                Status = status, Cnonce0 = cnonce0
            };
            var responseBytes = response.Encode();

            _ccpTransport.SendPacket(clientEndpoint, responseBytes);
        }
예제 #2
0
        void ProcessClientHello0(ICcpRemoteEndpoint clientEndpoint, BinaryReader reader, byte[] payloadData) // packets processor thread
        {
            var packet = new ClientHelloPacket0(reader, payloadData);

            if (!PassStatelessPoWfilter(clientEndpoint, packet))
            {
                return;
            }

            // create snonce0 state
            var snonce0 = _snonce0Table.GenerateOrGetExistingSnonce0(TimeSec32UTC, clientEndpoint);

            var response = new ServerHelloPacket0
            {
                Cnonce0 = packet.Cnonce0,
                Snonce0 = snonce0.Snonce0,
                Status  = ServerHello0Status.OK,
                StatefulProofOfWorkType = StatefulProofOfWorkType._2019_06
            };
            var responseBytes = response.Encode();

            _ccpTransport.SendPacket(clientEndpoint, responseBytes);
        }