diff --git a/LICENSE b/LICENSE
index 024073c02..5055c1434 100644
--- a/LICENSE
+++ b/LICENSE
@@ -1,4 +1,3 @@
-/bin/bash: wq: command not found
Version 3, 29 June 2007
Copyright (C) 2007 Free Software Foundation, Inc.
diff --git a/alethzero/Main.ui b/alethzero/Main.ui
index 73b45c43d..f233ed244 100644
--- a/alethzero/Main.ui
+++ b/alethzero/Main.ui
@@ -185,8 +185,9 @@
-
-
+
+
+
@@ -1672,10 +1673,10 @@ font-size: 14pt
- true
+ true
- &Use Private Chain...
+ &Use Private Chain...
@@ -1686,6 +1687,14 @@ font-size: 14pt
&Enable LLL &Optimizer
+
+
+ true
+
+
+ Reserved Debug 1
+
+
diff --git a/alethzero/MainWin.cpp b/alethzero/MainWin.cpp
index 08cda9ece..84f1af1ca 100644
--- a/alethzero/MainWin.cpp
+++ b/alethzero/MainWin.cpp
@@ -835,6 +835,11 @@ static bool transactionMatch(string const& _f, Transaction const& _t)
return false;
}
+void Main::on_turboMining_triggered()
+{
+ m_client->setTurboMining(ui->turboMining->isChecked());
+}
+
void Main::refreshBlockChain()
{
cwatch << "refreshBlockChain()";
diff --git a/alethzero/MainWin.h b/alethzero/MainWin.h
index da77fb8e1..d124b1fad 100644
--- a/alethzero/MainWin.h
+++ b/alethzero/MainWin.h
@@ -140,6 +140,7 @@ private slots:
void on_refresh_triggered();
void on_usePrivate_triggered();
void on_enableOptimizer_triggered();
+ void on_turboMining_triggered();
signals:
void poll();
diff --git a/libethcore/BlockInfo.cpp b/libethcore/BlockInfo.cpp
index a8af6fe21..1f845ad20 100644
--- a/libethcore/BlockInfo.cpp
+++ b/libethcore/BlockInfo.cpp
@@ -30,7 +30,7 @@
using namespace std;
using namespace eth;
-u256 eth::c_genesisDifficulty = (u256)1 << 12;
+u256 eth::c_genesisDifficulty = (u256)1 << 17;
BlockInfo::BlockInfo(): timestamp(Invalid256)
{
diff --git a/libethcore/Dagger.cpp b/libethcore/Dagger.cpp
index 1651a1941..4b5841d82 100644
--- a/libethcore/Dagger.cpp
+++ b/libethcore/Dagger.cpp
@@ -25,6 +25,7 @@
#include
#include
#include
+#include
#include
#include
#include "Dagger.h"
@@ -36,7 +37,7 @@ namespace eth
#if FAKE_DAGGER
-MineInfo Dagger::mine(h256& o_solution, h256 const& _root, u256 const& _difficulty, uint _msTimeout, bool const& _continue)
+MineInfo Dagger::mine(h256& o_solution, h256 const& _root, u256 const& _difficulty, uint _msTimeout, bool _continue, bool _turbo)
{
MineInfo ret{0.f, 1e99, 0, false};
static std::mt19937_64 s_eng((time(0) + (unsigned)m_last));
@@ -49,7 +50,10 @@ MineInfo Dagger::mine(h256& o_solution, h256 const& _root, u256 const& _difficul
// [--------*-------------------------]
//
// evaluate until we run out of time
- for (auto startTime = steady_clock::now(); (steady_clock::now() - startTime) < milliseconds(_msTimeout) && _continue; s++, ret.hashes++)
+ auto startTime = steady_clock::now();
+ if (!_turbo)
+ this_thread::sleep_for(chrono::milliseconds(_msTimeout * 90 / 100));
+ for (; (steady_clock::now() - startTime) < milliseconds(_msTimeout) && _continue; s++, ret.hashes++)
{
o_solution = (h256)s;
auto e = (bigint)(u256)eval(_root, o_solution);
diff --git a/libethcore/Dagger.h b/libethcore/Dagger.h
index e0c993ea7..e920549ce 100644
--- a/libethcore/Dagger.h
+++ b/libethcore/Dagger.h
@@ -52,7 +52,7 @@ public:
static h256 eval(h256 const& _root, h256 const& _nonce) { h256 b[2] = { _root, _nonce }; return sha3(bytesConstRef((byte const*)&b[0], 64)); }
static bool verify(h256 const& _root, h256 const& _nonce, u256 const& _difficulty) { return (bigint)(u256)eval(_root, _nonce) <= (bigint(1) << 256) / _difficulty; }
- MineInfo mine(h256& o_solution, h256 const& _root, u256 const& _difficulty, uint _msTimeout = 100, bool const& _continue = bool(true));
+ MineInfo mine(h256& o_solution, h256 const& _root, u256 const& _difficulty, uint _msTimeout = 100, bool _continue = true, bool _turbo = false);
h256 m_last;
};
diff --git a/libethereum/Client.cpp b/libethereum/Client.cpp
index 86c26d1db..d9798e88e 100644
--- a/libethereum/Client.cpp
+++ b/libethereum/Client.cpp
@@ -446,7 +446,7 @@ void Client::work(bool _justQueue)
m_restartMining = false;
// Mine for a while.
- MineInfo mineInfo = m_postMine.mine(100);
+ MineInfo mineInfo = m_postMine.mine(100, m_turboMining);
m_mineProgress.best = min(m_mineProgress.best, mineInfo.best);
m_mineProgress.current = mineInfo.best;
diff --git a/libethereum/Client.h b/libethereum/Client.h
index cb532d38f..f029e1d7f 100644
--- a/libethereum/Client.h
+++ b/libethereum/Client.h
@@ -304,6 +304,9 @@ public:
/// Clears pending transactions. Just for debug use.
void clearPending();
+ void setTurboMining(bool _enable = true) { m_turboMining = _enable; }
+ bool turboMining() const { return m_turboMining; }
+
private:
/// Ensure the worker thread is running. Needed for blockchain maintenance & mining.
void ensureWorking();
@@ -353,6 +356,7 @@ private:
bool m_paranoia = false;
bool m_doMine = false; ///< Are we supposed to be mining?
+ bool m_turboMining = false; ///< Don't squander all of our time mining actually just sleeping.
bool m_forceMining = false; ///< Mine even when there are no transactions pending?
MineProgress m_mineProgress;
std::list m_mineHistory;
diff --git a/libethereum/State.cpp b/libethereum/State.cpp
index 14db5c038..29f125a98 100644
--- a/libethereum/State.cpp
+++ b/libethereum/State.cpp
@@ -748,13 +748,13 @@ void State::commitToMine(BlockChain const& _bc)
m_currentBlock.parentHash = m_previousBlock.hash;
}
-MineInfo State::mine(uint _msTimeout)
+MineInfo State::mine(uint _msTimeout, bool _turbo)
{
// Update difficulty according to timestamp.
m_currentBlock.difficulty = m_currentBlock.calculateDifficulty(m_previousBlock);
// TODO: Miner class that keeps dagger between mine calls (or just non-polling mining).
- auto ret = m_dagger.mine(/*out*/m_currentBlock.nonce, m_currentBlock.headerHashWithoutNonce(), m_currentBlock.difficulty, _msTimeout);
+ auto ret = m_dagger.mine(/*out*/m_currentBlock.nonce, m_currentBlock.headerHashWithoutNonce(), m_currentBlock.difficulty, _msTimeout, true, _turbo);
if (!ret.completed)
m_currentBytes.clear();
diff --git a/libethereum/State.h b/libethereum/State.h
index da8e099d1..80380149f 100644
--- a/libethereum/State.h
+++ b/libethereum/State.h
@@ -157,7 +157,7 @@ public:
/// This function is thread-safe. You can safely have other interactions with this object while it is happening.
/// @param _msTimeout Timeout before return in milliseconds.
/// @returns Information on the mining.
- MineInfo mine(uint _msTimeout = 1000);
+ MineInfo mine(uint _msTimeout = 1000, bool _turbo = false);
/** Commit to DB and build the final block if the previous call to mine()'s result is completion.
* Typically looks like: