void MiningFrame::startStopClicked(QAbstractButton* _button) {
  if (_button == m_ui->m_startButton && m_ui->m_startButton->isChecked()) {
    startMining();
  } else if (_button == m_ui->m_stopButton && m_ui->m_stopButton->isChecked()) {
    stopMining();
  }
}
示例#2
0
void MiningFrame::startMiningClicked(bool _on) {
  if (_on) {
    m_ui->m_startMiningButton->setText(tr("Stop"));
    m_ui->m_startMiningButton->setFixedWidth(50);
    m_ui->m_hashrateLabel->setText("0 H/s");
    m_ui->m_donationHashRateLabel->setText("0 H/s");
    startMining();
  } else {
    m_ui->m_startMiningButton->setText(tr("Start mining"));
    m_ui->m_startMiningButton->setFixedWidth(190);
    stopMining();
  }

  m_ui->m_hashRateFrame->setVisible(_on);
}
示例#3
0
void MinerManager::eventLoop() {
  size_t blocksMined = 0;

  for (;;) {
    m_logger(Logging::DEBUGGING) << "waiting for event";
    MinerEvent event = waitEvent();

    switch (event.type) {
      case MinerEventType::BLOCK_MINED: {
        m_logger(Logging::DEBUGGING) << "got BLOCK_MINED event";
        stopBlockchainMonitoring();

        if (submitBlock(m_minedBlock, m_config.daemonHost, m_config.daemonPort)) {
          m_lastBlockTimestamp = m_minedBlock.timestamp;

          if (m_config.blocksLimit != 0 && ++blocksMined == m_config.blocksLimit) {
            m_logger(Logging::INFO) << "Miner mined requested " << m_config.blocksLimit << " blocks. Quitting";
            return;
          }
        }

        BlockMiningParameters params = requestMiningParameters(m_dispatcher, m_config.daemonHost, m_config.daemonPort, m_config.miningAddress);
        adjustBlockTemplate(params.blockTemplate);

        startBlockchainMonitoring();
        startMining(params);
        break;
      }

      case MinerEventType::BLOCKCHAIN_UPDATED: {
        m_logger(Logging::DEBUGGING) << "got BLOCKCHAIN_UPDATED event";
        stopMining();
        stopBlockchainMonitoring();
        BlockMiningParameters params = requestMiningParameters(m_dispatcher, m_config.daemonHost, m_config.daemonPort, m_config.miningAddress);
        adjustBlockTemplate(params.blockTemplate);

        startBlockchainMonitoring();
        startMining(params);
        break;
      }

      default:
        assert(false);
        return;
    }
  }
}
void MiningFrame::walletClosed() {
  stopMining();
}
MiningFrame::~MiningFrame() {
  stopMining();
}
void EthereumMiner::restartMining() {
    stopMining();
    startMining();
}