示例#1
0
        private void workerFunc(BlockTemplate blockTemplate, ulong difficulty, uint nonceStep)
        {
            try
            {
//C++ TO C# CONVERTER TODO TASK: The following line was determined to contain a copy constructor call - this should be verified and a copy constructor should be created:
//ORIGINAL LINE: BlockTemplate block = blockTemplate;
                BlockTemplate block = new BlockTemplate(blockTemplate);

                while (m_state == MiningState.MINING_IN_PROGRESS)
                {
                    CachedBlock cachedBlock = new CachedBlock(block);
                    Crypto.Hash hash        = cachedBlock.getBlockLongHash();
                    if (check_hash(hash, difficulty))
                    {
                        m_logger.functorMethod(Logging.Level.INFO) << "Found block for difficulty " << difficulty;

                        if (!setStateBlockFound())
                        {
                            m_logger.functorMethod(Logging.Level.DEBUGGING) << "block is already found or mining stopped";
                            return;
                        }

//C++ TO C# CONVERTER TODO TASK: The following line was determined to be a copy assignment (rather than a reference assignment) - this should be verified and a 'CopyFrom' method should be created:
//ORIGINAL LINE: m_block = block;
                        m_block.CopyFrom(block);
                        return;
                    }

                    incrementHashCount();
                    block.nonce += nonceStep;
                }
            }
            catch (System.Exception e)
            {
                m_logger.functorMethod(Logging.Level.ERROR) << "Miner got error: " << e.Message;
                m_state = MiningState.MINING_STOPPED;
            }
        }
示例#2
0
 public CachedBlock(BlockTemplate block)
 {
     this.block = block;
 }
示例#3
0
 public abstract bool GetBlockTemplate(BlockTemplate b, AccountPublicAddress adr, BinaryArray extraNonce, ref ulong difficulty, ref uint height);
 public static ushort functorMethod(CryptoNote.BlockTemplate UnnamedParameter)
 {
     return(0xbb);
 }