コード例 #1
0
        public async Task <string> QueryPrehashmkl(long syncHeight, string ipEndPoint = null)
        {
            Q2P_Prehashmkl q2p_PreHash = new Q2P_Prehashmkl();

            q2p_PreHash.ActorId = nodeManager.GetMyNodeId();
            q2p_PreHash.height  = syncHeight;

            Session session = null;

            if (ipEndPoint != null && ipEndPoint != "")
            {
                session = await networkInner.Get(NetworkHelper.ToIPEndPoint(ipEndPoint));
            }
            if (session != null && !session.IsConnect())
            {
                session = null;
            }

            if (session == null)
            {
                NodeManager.NodeData node = nodeManager.GetRandomNode();
                if (node != null)
                {
                    session = await networkInner.Get(NetworkHelper.ToIPEndPoint(node.ipEndPoint));
                }
            }

            if (session != null)
            {
                R2P_Prehashmkl r2p_Prehashmkl = (R2P_Prehashmkl)await session.Query(q2p_PreHash);

                return(r2p_Prehashmkl != null ? r2p_Prehashmkl.prehashmkl : "");
            }
            return("");
        }
コード例 #2
0
        public static void Q2P_Prehashmkl_Handle(Session session, int opcode, object msg)
        {
            Q2P_Prehashmkl q2p_Prehashmkl = msg as Q2P_Prehashmkl;
            Block          mcbkl          = BlockChainHelper.GetMcBlock(q2p_Prehashmkl.height);
            R2P_Prehashmkl r2p_Prehashmkl = new R2P_Prehashmkl()
            {
                prehashmkl = mcbkl != null ? mcbkl.prehashmkl : ""
            };

            session.Reply(q2p_Prehashmkl, r2p_Prehashmkl);
        }