GetSolutionString() public method

public GetSolutionString ( uint solution ) : string
solution uint
return string
        public void WorkComplete(Client solver, bool solutionFound, uint solution)
        {
            mEventLog.RecordClientWork(solver);
            WorkBlock block = solver.mCurrentBlock;

            block.mHashMan.FinishBlock(solver.mHashBlock);
            solver.mHashBlock = null;

            if (solutionFound && mBlock == block)
            {
                mBlocksSubmitted++;
                bool success = mUpstream.SubmitWork(block, solution);
                //if (!success)
                //    success = mUpstream.SubmitWork(block, (uint)IPAddress.HostToNetworkOrder((int)solution));

                // Start a new block
                if (success)
                {
                    // Send email notification about this found solution

                    /*
                     * TimeSpan span = DateTime.Now - block.mHashMan.mStartTime;
                     * string hashrate = string.Format("{0:N}", block.mHashMan.mHashesDone / span.TotalSeconds);
                     * string body = "Found solution for " + block.mCurrency + " block: \n" + block.ToString() + "\n\n";
                     * body += "Solution string: " + data + "\n";
                     * body += "Block Accepted: " + success.ToString() + "\n";
                     * body += "Hashes Done: " + block.mHashMan.mHashesDone + "\n";
                     * body += "Time Spent: " + span.ToString() + "\n";
                     * body += "Hashrate: " + hashrate + "\n";
                     * body += "Clients: " + mClients.Count + "\n";
                     * body += "\n\n";
                     * //mMailer.SendEmail(body);
                     */
                    //mMailer.SendEmail("Block Accepted");

                    string data = block.GetSolutionString(solution);
                    mEventLog.RecordEvent(EventLog.EventType.Upstream, string.Format("Work accepted! solution: {0}, dataString: {1}", solution, data));

                    BeginBlock();
                    mBlocksAccepted++;
                }
                else
                {
                    string data = block.GetSolutionString(solution);
                    mEventLog.RecordEvent(EventLog.EventType.Upstream, string.Format("Work not accepted. solution: {0}, dataString: {1}", solution, data));
                }
            }
        }
Ejemplo n.º 2
0
        public override bool SubmitWork(WorkBlock work, uint solution)
        {
            // Submit this solution to bitcoin
            string data = work.GetSolutionString(solution);

            Console.WriteLine("Trying solution: " + data);
            BitnetClient bc = new BitnetClient("http://" + mURL + ":" + mPort);

            bc.Credentials = new NetworkCredential(mUser, mPass);
            bool success = bc.GetWork(data);

            if (!success)
            {
                data    = work.GetSolutionString((uint)IPAddress.HostToNetworkOrder((int)solution));
                success = bc.GetWork(data);
            }

            return(success);
        }
Ejemplo n.º 3
0
        public override bool SubmitWork(WorkBlock work, uint solution)
        {
            // Submit this solution to bitcoin
            string data = work.GetSolutionString(solution);
            Console.WriteLine("Trying solution: " + data);
            BitnetClient bc = new BitnetClient("http://" + mURL + ":" + mPort);
            bc.Credentials = new NetworkCredential(mUser, mPass);
            bool success = bc.GetWork(data);
            if (!success)
            {
                data = work.GetSolutionString((uint)IPAddress.HostToNetworkOrder((int)solution));
                success = bc.GetWork(data);
            }

            return success;
        }