From 8d4b71af5ac55d5a881da7109cfc60b1326d374d Mon Sep 17 00:00:00 2001 From: AronVanAmmers Date: Thu, 2 Oct 2014 20:51:07 +0200 Subject: [PATCH 1/5] Fix build by including all files from CryptoPP that compile without errors or warnings. --- windows/LibCryptoPP.vcxproj | 240 ++++++++++++++++++++++++++++++++++++ 1 file changed, 240 insertions(+) diff --git a/windows/LibCryptoPP.vcxproj b/windows/LibCryptoPP.vcxproj index 51e509a45..032ae5fa6 100644 --- a/windows/LibCryptoPP.vcxproj +++ b/windows/LibCryptoPP.vcxproj @@ -19,35 +19,275 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + From 305fe6353ca53417450d36afa35cfec6e07f8091 Mon Sep 17 00:00:00 2001 From: AronVanAmmers Date: Thu, 2 Oct 2014 20:55:03 +0200 Subject: [PATCH 2/5] Fix build on Windows. QWebSettings is somehow not available. --- alethzero/MainWin.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/alethzero/MainWin.cpp b/alethzero/MainWin.cpp index 5df652568..32b38be5a 100644 --- a/alethzero/MainWin.cpp +++ b/alethzero/MainWin.cpp @@ -25,7 +25,7 @@ #include #include #include -#include +//#include #include #include #include @@ -138,7 +138,7 @@ Main::Main(QWidget *parent) : m_ethereum = new QEthereum(this, ethereum(), owned()); m_whisper = new QWhisper(this, whisper()); - QWebSettings::globalSettings()->setAttribute(QWebSettings::DeveloperExtrasEnabled, true); + //QWebSettings::globalSettings()->setAttribute(QWebSettings::DeveloperExtrasEnabled, true); QWebFrame* f = ui->webView->page()->mainFrame(); f->disconnect(SIGNAL(javaScriptWindowObjectCleared())); auto qeth = m_ethereum; From 84e57e30e0ea6e97a75a67f339a8f4f6b7d4462a Mon Sep 17 00:00:00 2001 From: AronVanAmmers Date: Fri, 3 Oct 2014 13:26:59 +0200 Subject: [PATCH 3/5] Upstream fix --- alethzero/MainWin.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/alethzero/MainWin.cpp b/alethzero/MainWin.cpp index 32b38be5a..2181098a9 100644 --- a/alethzero/MainWin.cpp +++ b/alethzero/MainWin.cpp @@ -25,7 +25,7 @@ #include #include #include -//#include +#include #include #include #include @@ -138,7 +138,7 @@ Main::Main(QWidget *parent) : m_ethereum = new QEthereum(this, ethereum(), owned()); m_whisper = new QWhisper(this, whisper()); - //QWebSettings::globalSettings()->setAttribute(QWebSettings::DeveloperExtrasEnabled, true); + QWebSettings::globalSettings()->setAttribute(QWebSettings::DeveloperExtrasEnabled, true); QWebFrame* f = ui->webView->page()->mainFrame(); f->disconnect(SIGNAL(javaScriptWindowObjectCleared())); auto qeth = m_ethereum; From 0a78ad9b21685c4dbaece664342d7410c662de29 Mon Sep 17 00:00:00 2001 From: Gav Wood Date: Fri, 3 Oct 2014 14:23:34 +0200 Subject: [PATCH 4/5] paranoia works again. --- libethereum/State.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libethereum/State.cpp b/libethereum/State.cpp index 362e2c94c..1dfa7aeef 100644 --- a/libethereum/State.cpp +++ b/libethereum/State.cpp @@ -966,7 +966,7 @@ bool State::isTrieGood(bool _enforceRefs, bool _requireNoLeftOvers) const RLP r(i.second); TrieDB storageDB(const_cast(&m_db), r[2].toHash()); // promise not to alter OverlayDB. for (auto const& j: storageDB) { (void)j; } - if (!e && r[3].toHash() != EmptySHA3 && m_db.lookup(r[3].toHash()).empty()) + if (!e && r[3].toHash() && m_db.lookup(r[3].toHash()).empty()) return false; } } From 95c063202cd2397aa946fecfb30a2ba98173a7a3 Mon Sep 17 00:00:00 2001 From: Gav Wood Date: Sun, 5 Oct 2014 14:02:14 +0200 Subject: [PATCH 5/5] Block hash download fix. --- libethereum/EthereumHost.cpp | 13 ++++++++++--- libwhisper/WhisperPeer.cpp | 18 ++++++++++-------- 2 files changed, 20 insertions(+), 11 deletions(-) diff --git a/libethereum/EthereumHost.cpp b/libethereum/EthereumHost.cpp index de0e991e6..e7e80c28a 100644 --- a/libethereum/EthereumHost.cpp +++ b/libethereum/EthereumHost.cpp @@ -74,12 +74,19 @@ void EthereumHost::noteHavePeerState(EthereumPeer* _who) { clog(NetAllDetail) << "Have peer state."; + // TODO: FIX: BUG: Better state management! + // if already downloading hash-chain, ignore. if (m_grabbing != Grabbing::Nothing) { - clog(NetAllDetail) << "Already downloading chain. Just set to help out."; - _who->ensureGettingChain(); - return; + for (auto const& i: peers()) + if (i->cap()->m_grabbing == m_grabbing || m_grabbing == Grabbing::State) + { + clog(NetAllDetail) << "Already downloading chain. Just set to help out."; + _who->ensureGettingChain(); + return; + } + m_grabbing = Grabbing::Nothing; } // otherwise check to see if we should be downloading... diff --git a/libwhisper/WhisperPeer.cpp b/libwhisper/WhisperPeer.cpp index 4baccdf9c..e92e2cac3 100644 --- a/libwhisper/WhisperPeer.cpp +++ b/libwhisper/WhisperPeer.cpp @@ -92,15 +92,17 @@ void WhisperPeer::sendMessages() n++; } - // pause before sending if no messages to send - if (!n) + if (n) + { + RLPStream s; + prep(s); + s.appendList(n + 1) << MessagesPacket; + s.appendRaw(amalg.out(), n); + sealAndSend(s); + } + else + // just pause if no messages to send this_thread::sleep_for(chrono::milliseconds(100)); - - RLPStream s; - prep(s); - s.appendList(n + 1) << MessagesPacket; - s.appendRaw(amalg.out(), n); - sealAndSend(s); } void WhisperPeer::noteNewMessage(h256 _h, Message const& _m)