Beispiel #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;
            }
        }
Beispiel #2
0
 public abstract AddBlockErrorCode AddBlock(CachedBlock cachedBlock, RawBlock rawBlock);
//C++ TO C# CONVERTER TODO TASK: 'rvalue references' have no equivalent in C#:
        public abstract void pushBlock(CachedBlock cachedBlock, List <CachedTransaction> cachedTransactions, TransactionValidatorState validatorState, uint blockSize, ulong generatedCoins, ulong blockDifficulty, RawBlock&& rawBlock);