Browse Source

Merge branch 'develop' of https://github.com/ethereum/cpp-ethereum into develop

cl-refactor
Paweł Bylica 10 years ago
parent
commit
e12ca124db
  1. 4
      alethzero/DownloadView.cpp
  2. 2
      alethzero/Main.ui
  3. 41
      alethzero/MainWin.cpp
  4. 3
      alethzero/MainWin.h
  5. 2
      libdevcore/Common.cpp
  6. 10
      libdevcore/RangeMask.h
  7. 14
      libdevcrypto/SHA3.cpp
  8. 2
      libethcore/CommonEth.cpp
  9. 18
      libethereum/DownloadMan.h
  10. 25
      libethereum/EthereumHost.cpp
  11. 43
      libethereum/EthereumPeer.cpp
  12. 3
      libethereum/EthereumPeer.h
  13. 4
      libethereum/Executive.cpp
  14. 4
      libethereum/State.cpp
  15. 1
      libp2p/Common.h
  16. 4
      libp2p/Session.cpp
  17. 4
      libp2p/Session.h
  18. 2
      libqethereum/QEthereum.h
  19. 18
      libwhisper/WhisperPeer.cpp
  20. 4
      merge.sh
  21. 2
      third/MainWin.cpp
  22. 240
      windows/LibCryptoPP.vcxproj

4
alethzero/DownloadView.cpp

@ -51,7 +51,7 @@ void DownloadView::paintEvent(QPaintEvent*)
QSizeF area(n, n);
QPointF pos(0, 0);
auto const& bg = m_man->blocksGot();
auto bg = m_man->blocksGot();
for (unsigned i = bg.all().first, ei = bg.all().second; i < ei; ++i)
{
@ -63,7 +63,7 @@ void DownloadView::paintEvent(QPaintEvent*)
unsigned h = 0;
m_man->foreachSub([&](DownloadSub const& sub)
{
if (sub.asked().contains(i))
if (sub.askedContains(i))
s = h;
h++;
});

2
alethzero/Main.ui

@ -1756,7 +1756,7 @@ font-size: 14pt</string>
</action>
<action name="importKeyFile">
<property name="text">
<string>Import Key &amp;File...</string>
<string>Claim Ether Presale &amp;Wallet...</string>
</property>
</action>
<action name="go">

41
alethzero/MainWin.cpp

@ -25,6 +25,7 @@
#include <QtWidgets/QMessageBox>
#include <QtWidgets/QInputDialog>
#include <QtWebKitWidgets/QWebFrame>
#include <QtWebKit/QWebSettings>
#include <QtGui/QClipboard>
#include <QtCore/QtCore>
#include <boost/algorithm/string.hpp>
@ -137,6 +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);
QWebFrame* f = ui->webView->page()->mainFrame();
f->disconnect(SIGNAL(javaScriptWindowObjectCleared()));
auto qeth = m_ethereum;
@ -460,7 +462,7 @@ QString Main::lookup(QString const& _a) const
void Main::on_about_triggered()
{
QMessageBox::about(this, "About AlethZero PoC-" + QString(dev::Version).section('.', 1, 1), QString("AlethZero/v") + dev::Version + "/" DEV_QUOTED(ETH_BUILD_TYPE) "/" DEV_QUOTED(ETH_BUILD_PLATFORM) "\n" DEV_QUOTED(ETH_COMMIT_HASH) + (ETH_CLEAN_REPO ? "\nCLEAN" : "\n+ LOCAL CHANGES") + "\n\nBy Gav Wood, 2014.\nBased on a design by Vitalik Buterin.\n\nThanks to the various contributors including: Alex Leverington, Tim Hughes, caktux, Eric Lombrozo, Marko Simovic.");
QMessageBox::about(this, "About AlethZero PoC-" + QString(dev::Version).section('.', 1, 1), QString("AlethZero/v") + dev::Version + "/" DEV_QUOTED(ETH_BUILD_TYPE) "/" DEV_QUOTED(ETH_BUILD_PLATFORM) "\n" DEV_QUOTED(ETH_COMMIT_HASH) + (ETH_CLEAN_REPO ? "\nCLEAN" : "\n+ LOCAL CHANGES") + "\n\nBy Gav Wood, 2014.\nThis software wouldn't be where it is today without the many leaders & contributors including:\n\nVitalik Buterin, Tim Hughes, caktux, Nick Savers, Eric Lombrozo, Marko Simovic, the many testers and the Berlin \304\220\316\236V team.");
}
void Main::on_paranoia_triggered()
@ -564,8 +566,7 @@ void Main::on_importKey_triggered()
if (std::find(m_myKeys.begin(), m_myKeys.end(), k) == m_myKeys.end())
{
m_myKeys.append(k);
m_keysChanged = true;
update();
keysChanged();
}
else
QMessageBox::warning(this, "Already Have Key", "Could not import the secret key: we already own this account.");
@ -585,20 +586,29 @@ void Main::on_importKeyFile_triggered()
if (obj["encseed"].type() == js::str_type)
{
auto encseed = fromHex(obj["encseed"].get_str());
KeyPair k = KeyPair::fromEncryptedSeed(&encseed, QInputDialog::getText(this, "Enter Password", "Enter the wallet's passphrase", QLineEdit::Password).toStdString());
if (obj["ethaddr"].type() == js::str_type)
KeyPair k;
for (bool gotit = false; !gotit;)
{
Address a(obj["ethaddr"].get_str());
Address b = k.address();
if (a != b && QMessageBox::warning(this, "Key File Invalid", "Could not import the secret key: it doesn't agree with the given address.\nWould you like to attempt to import anyway?", QMessageBox::Yes | QMessageBox::No) == QMessageBox::No)
return;
gotit = true;
k = KeyPair::fromEncryptedSeed(&encseed, QInputDialog::getText(this, "Enter Password", "Enter the wallet's passphrase", QLineEdit::Password).toStdString());
if (obj["ethaddr"].type() == js::str_type)
{
Address a(obj["ethaddr"].get_str());
Address b = k.address();
if (a != b)
{
if (QMessageBox::warning(this, "Password Wrong", "Could not import the secret key: the password you gave appears to be wrong.", QMessageBox::Retry, QMessageBox::Cancel) == QMessageBox::Cancel)
return;
else
gotit = false;
}
}
}
if (std::find(m_myKeys.begin(), m_myKeys.end(), k) == m_myKeys.end())
{
m_myKeys.append(k);
m_keysChanged = true;
update();
keysChanged();
}
else
QMessageBox::warning(this, "Already Have Key", "Could not import the secret key: we already own this account.");
@ -733,7 +743,7 @@ void Main::refreshNetwork()
ui->peerCount->setText(QString::fromStdString(toString(ps.size())) + " peer(s)");
ui->peers->clear();
for (PeerInfo const& i: ps)
ui->peers->addItem(QString("[%6] %3 ms - %1:%2 - %4 %5").arg(i.host.c_str()).arg(i.port).arg(chrono::duration_cast<chrono::milliseconds>(i.lastPing).count()).arg(i.clientVersion.c_str()).arg(QString::fromStdString(toString(i.caps))).arg(i.socket));
ui->peers->addItem(QString("[%7] %3 ms - %1:%2 - %4 %5 %6").arg(i.host.c_str()).arg(i.port).arg(chrono::duration_cast<chrono::milliseconds>(i.lastPing).count()).arg(i.clientVersion.c_str()).arg(QString::fromStdString(toString(i.caps))).arg(QString::fromStdString(toString(i.notes))).arg(i.socket));
}
void Main::refreshAll()
@ -1587,6 +1597,11 @@ void Main::on_send_clicked()
statusBar()->showMessage("Couldn't make transaction: no single account contains at least the required amount.");
}
void Main::keysChanged()
{
onBalancesChange();
}
void Main::on_debug_clicked()
{
debugFinished();
@ -1623,7 +1638,7 @@ void Main::on_debug_clicked()
void Main::on_create_triggered()
{
m_myKeys.append(KeyPair::create());
m_keysChanged = true;
keysChanged();
}
void Main::on_debugStep_triggered()

3
alethzero/MainWin.h

@ -184,6 +184,8 @@ private:
unsigned installWatch(dev::eth::MessageFilter const& _tf, std::function<void()> const& _f);
unsigned installWatch(dev::h256 _tf, std::function<void()> const& _f);
void keysChanged();
void onNewPending();
void onNewBlock();
void onNameRegChange();
@ -221,7 +223,6 @@ private:
QStringList m_servers;
QList<dev::KeyPair> m_myKeys;
QString m_privateChain;
bool m_keysChanged = false;
dev::bytes m_data;
dev::Address m_nameReg;

2
libdevcore/Common.cpp

@ -27,7 +27,7 @@ using namespace dev;
namespace dev
{
char const* Version = "0.6.10";
char const* Version = "0.6.11";
}

10
libdevcore/RangeMask.h

@ -43,7 +43,7 @@ public:
using Range = std::pair<T, T>;
using Ranges = std::vector<Range>;
RangeMask() {}
RangeMask(): m_all(0, 0) {}
RangeMask(T _begin, T _end): m_all(_begin, _end) {}
RangeMask(Range const& _c): m_all(_c) {}
@ -150,7 +150,7 @@ public:
bool full() const
{
return m_ranges.size() == 1 && m_ranges.begin()->first == m_all.first && m_ranges.begin()->second == m_all.second;
return m_all.first == m_all.second || (m_ranges.size() == 1 && m_ranges.begin()->first == m_all.first && m_ranges.begin()->second == m_all.second);
}
void clear()
@ -158,6 +158,12 @@ public:
m_ranges.clear();
}
void reset()
{
m_ranges.clear();
m_all = std::make_pair(0, 0);
}
std::pair<T, T> const& all() const { return m_all; }
class const_iterator

14
libdevcrypto/SHA3.cpp

@ -72,21 +72,25 @@ h256 sha3(bytesConstRef _input)
return ret;
}
bytes aesDecrypt(bytesConstRef _cipher, std::string const& _password, unsigned _rounds, bytesConstRef _salt)
bytes aesDecrypt(bytesConstRef _ivCipher, std::string const& _password, unsigned _rounds, bytesConstRef _salt)
{
bytes pw = asBytes(_password);
bytes target(CryptoPP::AES::DEFAULT_KEYLENGTH);
if (!_salt.size())
_salt = &pw;
bytes target(64);
CryptoPP::PKCS5_PBKDF2_HMAC<CryptoPP::SHA256>().DeriveKey(target.data(), target.size(), 0, pw.data(), pw.size(), _salt.data(), _salt.size(), _rounds);
try
{
CryptoPP::AES::Decryption aesDecryption(target.data(), target.size());
bytes iv(CryptoPP::AES::BLOCKSIZE);
CryptoPP::AES::Decryption aesDecryption(target.data(), 16);
auto cipher = _ivCipher.cropped(16);
auto iv = _ivCipher.cropped(0, 16);
CryptoPP::CBC_Mode_ExternalCipher::Decryption cbcDecryption(aesDecryption, iv.data());
std::string decrypted;
CryptoPP::StreamTransformationFilter stfDecryptor(cbcDecryption, new CryptoPP::StringSink(decrypted));
stfDecryptor.Put(_cipher.data(), _cipher.size());
stfDecryptor.Put(cipher.data(), cipher.size());
stfDecryptor.MessageEnd();
return asBytes(decrypted);
}

2
libethcore/CommonEth.cpp

@ -35,7 +35,7 @@ namespace eth
{
const unsigned c_protocolVersion = 33;
const unsigned c_databaseVersion = 1;
const unsigned c_databaseVersion = 2;
static const vector<pair<u256, string>> g_units =
{

18
libethereum/DownloadMan.h

@ -54,6 +54,7 @@ public:
/// Nothing doing here.
void doneFetch() { resetFetch(); }
bool askedContains(unsigned _i) const { Guard l(m_fetch); return m_asked.contains(_i); }
RangeMask<unsigned> const& asked() const { return m_asked; }
RangeMask<unsigned> const& attemped() const { return m_attempted; }
@ -63,13 +64,13 @@ private:
Guard l(m_fetch);
m_remaining.clear();
m_indices.clear();
m_asked.clear();
m_attempted.clear();
m_asked.reset();
m_attempted.reset();
}
DownloadMan* m_man = nullptr;
Mutex m_fetch;
mutable Mutex m_fetch;
h256Set m_remaining;
std::map<h256, unsigned> m_indices;
RangeMask<unsigned> m_asked;
@ -94,6 +95,7 @@ public:
for (auto i: m_subs)
i->resetFetch();
}
WriteGuard l(m_lock);
m_chain.clear();
m_chain.reserve(_chain.size());
for (auto i = _chain.rbegin(); i != _chain.rend(); ++i)
@ -108,12 +110,14 @@ public:
for (auto i: m_subs)
i->resetFetch();
}
WriteGuard l(m_lock);
m_chain.clear();
m_blocksGot.clear();
m_blocksGot.reset();
}
RangeMask<unsigned> taken(bool _desperate = false) const
{
ReadGuard l(m_lock);
auto ret = m_blocksGot;
if (!_desperate)
{
@ -126,15 +130,17 @@ public:
bool isComplete() const
{
ReadGuard l(m_lock);
return m_blocksGot.full();
}
h256s chain() const { return m_chain; }
h256s chain() const { ReadGuard l(m_lock); return m_chain; }
void foreachSub(std::function<void(DownloadSub const&)> const& _f) const { ReadGuard l(x_subs); for(auto i: m_subs) _f(*i); }
unsigned subCount() const { ReadGuard l(x_subs); return m_subs.size(); }
RangeMask<unsigned> blocksGot() const { return m_blocksGot; }
RangeMask<unsigned> blocksGot() const { ReadGuard l(m_lock); return m_blocksGot; }
private:
mutable SharedMutex m_lock;
h256s m_chain;
RangeMask<unsigned> m_blocksGot;

25
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<EthereumPeer>()->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...
@ -102,7 +109,7 @@ void EthereumHost::noteHaveChain(EthereumPeer* _from)
if (_from->m_neededBlocks.empty())
{
_from->m_grabbing = Grabbing::Nothing;
_from->setGrabbing(Grabbing::Nothing);
updateGrabbing(Grabbing::Nothing);
return;
}
@ -112,7 +119,7 @@ void EthereumHost::noteHaveChain(EthereumPeer* _from)
if (td < m_chain.details().totalDifficulty || (td == m_chain.details().totalDifficulty && m_chain.currentHash() == _from->m_latestHash))
{
clog(NetNote) << "Difficulty of hashchain not HIGHER. Ignoring.";
_from->m_grabbing = Grabbing::Nothing;
_from->setGrabbing(Grabbing::Nothing);
updateGrabbing(Grabbing::Nothing);
return;
}
@ -123,7 +130,7 @@ void EthereumHost::noteHaveChain(EthereumPeer* _from)
m_man.resetToChain(_from->m_neededBlocks);
m_latestBlockSent = _from->m_latestHash;
_from->m_grabbing = Grabbing::Chain;
_from->setGrabbing(Grabbing::Chain);
updateGrabbing(Grabbing::Chain);
}
@ -266,7 +273,11 @@ void EthereumHost::maintainBlocks(BlockQueue& _bq, h256 _currentHash)
}
clog(NetMessageSummary) << "Sending" << c << "new blocks (current is" << _currentHash << ", was" << m_latestBlockSent << ")";
if (c > 1000)
cwarn << "Gaa sending an awful lot of new blocks. Sure this is right?";
{
cwarn << "Gaa this would be an awful lot of new blocks. Not bothering";
return;
}
ts.appendList(1 + c).append(BlocksPacket).appendRaw(bs, c);
bytes b;
ts.swapOut(b);

43
libethereum/EthereumPeer.cpp

@ -38,6 +38,7 @@ EthereumPeer::EthereumPeer(Session* _s, HostCapabilityFace* _h):
Capability(_s, _h),
m_sub(host()->m_man)
{
setGrabbing(Grabbing::State);
sendStatus();
}
@ -94,7 +95,7 @@ void EthereumPeer::tryGrabbingHashChain()
if (td >= m_totalDifficulty)
{
clogS(NetAllDetail) << "No. Our chain is better.";
m_grabbing = Grabbing::Nothing;
setGrabbing(Grabbing::Nothing);
return; // All good - we have the better chain.
}
@ -103,7 +104,7 @@ void EthereumPeer::tryGrabbingHashChain()
clogS(NetAllDetail) << "Yes. Their chain is better.";
host()->updateGrabbing(Grabbing::Hashes);
m_grabbing = Grabbing::Hashes;
setGrabbing(Grabbing::Hashes);
RLPStream s;
prep(s).appendList(3);
s << GetBlockHashesPacket << m_latestHash << c_maxHashesAsk;
@ -114,17 +115,17 @@ void EthereumPeer::tryGrabbingHashChain()
void EthereumPeer::giveUpOnFetch()
{
clogS(NetNote) << "GIVE UP FETCH";
clogS(NetNote) << "Finishing fetch...";
// a bit overkill given that the other nodes may yet have the needed blocks, but better to be safe than sorry.
if (m_grabbing == Grabbing::Chain || m_grabbing == Grabbing::ChainHelper)
{
host()->noteDoneBlocks(this);
m_grabbing = Grabbing::Nothing;
setGrabbing(Grabbing::Nothing);
}
m_sub.doneFetch();
// NOTE: need to notify of giving up on chain-hashes, too, altering state as necessary.
m_sub.doneFetch();
}
bool EthereumPeer::interpret(RLP const& _r)
@ -143,12 +144,14 @@ bool EthereumPeer::interpret(RLP const& _r)
if (genesisHash != host()->m_chain.genesisHash())
disable("Invalid genesis hash");
if (m_protocolVersion != host()->protocolVersion())
else if (m_protocolVersion != host()->protocolVersion())
disable("Invalid protocol version.");
if (m_networkId != host()->networkId())
else if (m_networkId != host()->networkId())
disable("Invalid network identifier.");
startInitialSync();
else if (session()->info().clientVersion.find("/v0.6.9/") != string::npos)
disable("Blacklisted client version.");
else
startInitialSync();
break;
}
case GetTransactionsPacket:
@ -244,8 +247,8 @@ bool EthereumPeer::interpret(RLP const& _r)
if (_r.itemCount() == 1)
{
// Couldn't get any from last batch - probably got to this peer's latest block - just give up.
m_sub.doneFetch();
giveUpOnFetch();
if (m_grabbing == Grabbing::Chain || m_grabbing == Grabbing::ChainHelper)
giveUpOnFetch();
break;
}
@ -283,7 +286,8 @@ bool EthereumPeer::interpret(RLP const& _r)
}
}
clogS(NetMessageSummary) << dec << knownParents << "known parents," << unknownParents << "unknown," << used << "used.";
continueGettingChain();
if (m_grabbing == Grabbing::Chain || m_grabbing == Grabbing::ChainHelper)
continueGettingChain();
break;
}
default:
@ -297,13 +301,18 @@ void EthereumPeer::ensureGettingChain()
if (m_grabbing == Grabbing::ChainHelper)
return; // Already asked & waiting for some.
// Switch to ChainHelper otherwise, unless we're already the Chain grabber.
if (m_grabbing != Grabbing::Chain)
setGrabbing(Grabbing::ChainHelper);
continueGettingChain();
}
void EthereumPeer::continueGettingChain()
{
if (m_grabbing != Grabbing::Chain)
m_grabbing = Grabbing::ChainHelper;
// If we're getting the hashes already, then we shouldn't be asking for the chain.
if (m_grabbing == Grabbing::Hashes)
return;
auto blocks = m_sub.nextFetch(c_maxBlocksAsk);
@ -319,3 +328,9 @@ void EthereumPeer::continueGettingChain()
else
giveUpOnFetch();
}
void EthereumPeer::setGrabbing(Grabbing _g)
{
m_grabbing = _g;
session()->addNote("grab", _g == Grabbing::Nothing ? "nothing" : _g == Grabbing::State ? "state" : _g == Grabbing::Hashes ? "hashes" : _g == Grabbing::Chain ? "chain" : _g == Grabbing::ChainHelper ? "chainhelper" : "?");
}

3
libethereum/EthereumPeer.h

@ -71,11 +71,12 @@ private:
void giveUpOnFetch();
void clearKnownTransactions() { std::lock_guard<std::mutex> l(x_knownTransactions); m_knownTransactions.clear(); }
void setGrabbing(Grabbing _g);
unsigned m_protocolVersion;
u256 m_networkId;
Grabbing m_grabbing = Grabbing::State;
Grabbing m_grabbing;
h256 m_latestHash; ///< Peer's latest block's hash.
u256 m_totalDifficulty; ///< Peer's latest block's total difficulty.

4
libethereum/Executive.cpp

@ -131,11 +131,9 @@ bool Executive::create(Address _sender, u256 _endowment, u256 _gasPrice, u256 _g
// We can allow for the reverted state (i.e. that with which m_ext is constructed) to contain the m_newAddress, since
// we delete it explicitly if we decide we need to revert.
m_newAddress = right160(sha3(rlpList(_sender, m_s.transactionsFrom(_sender) - 1)));
while (m_s.addressInUse(m_newAddress))
m_newAddress = (u160)m_newAddress + 1;
// Set up new account...
m_s.m_cache[m_newAddress] = AddressState(0, _endowment, h256(), h256());
m_s.m_cache[m_newAddress] = AddressState(0, m_s.balance(m_newAddress) + _endowment, h256(), h256());
// Execute _init.
m_vm = new VM(_gas);

4
libethereum/State.cpp

@ -966,7 +966,7 @@ bool State::isTrieGood(bool _enforceRefs, bool _requireNoLeftOvers) const
RLP r(i.second);
TrieDB<h256, OverlayDB> storageDB(const_cast<OverlayDB*>(&m_db), r[2].toHash<h256>()); // promise not to alter OverlayDB.
for (auto const& j: storageDB) { (void)j; }
if (!e && r[3].toHash<h256>() != EmptySHA3 && m_db.lookup(r[3].toHash<h256>()).empty())
if (!e && r[3].toHash<h256>() && m_db.lookup(r[3].toHash<h256>()).empty())
return false;
}
}
@ -1133,7 +1133,7 @@ h160 State::create(Address _sender, u256 _endowment, u256 _gasPrice, u256* _gas,
newAddress = (u160)newAddress + 1;
// Set up new account...
m_cache[newAddress] = AddressState(0, _endowment, h256(), h256());
m_cache[newAddress] = AddressState(0, balance(newAddress) + _endowment, h256(), h256());
// Execute init code.
VM vm(*_gas);

1
libp2p/Common.h

@ -96,6 +96,7 @@ struct PeerInfo
std::chrono::steady_clock::duration lastPing;
std::set<std::string> caps;
unsigned socket;
std::map<std::string, std::string> notes;
};
}

4
libp2p/Session.cpp

@ -40,7 +40,7 @@ Session::Session(Host* _s, bi::tcp::socket _socket, bi::address _peerAddress, un
{
m_disconnect = std::chrono::steady_clock::time_point::max();
m_connect = std::chrono::steady_clock::now();
m_info = PeerInfo({"?", _peerAddress.to_string(), m_listenPort, std::chrono::steady_clock::duration(0), set<string>(), 0});
m_info = PeerInfo({"?", _peerAddress.to_string(), m_listenPort, std::chrono::steady_clock::duration(0), set<string>(), 0, map<string, string>()});
}
Session::~Session()
@ -102,7 +102,7 @@ bool Session::interpret(RLP const& _r)
return false;
}
try
{ m_info = PeerInfo({clientVersion, m_socket.remote_endpoint().address().to_string(), m_listenPort, std::chrono::steady_clock::duration(), _r[3].toSet<string>(), (unsigned)m_socket.native_handle()}); }
{ m_info = PeerInfo({clientVersion, m_socket.remote_endpoint().address().to_string(), m_listenPort, std::chrono::steady_clock::duration(), _r[3].toSet<string>(), (unsigned)m_socket.native_handle(), map<string, string>() }); }
catch (...)
{
disconnect(BadProtocol);

4
libp2p/Session.h

@ -71,6 +71,10 @@ public:
void addRating(unsigned _r) { m_rating += _r; }
void addNote(std::string const& _k, std::string const& _v) { m_info.notes[_k] = _v; }
PeerInfo const& info() const { return m_info; }
private:
void dropped();
void doRead();

2
libqethereum/QEthereum.h

@ -269,8 +269,6 @@ private:
frame->evaluateJavaScript("String.prototype.dec = function() { env.warn('THIS CALL IS DEPRECATED. USE eth.* INSTEAD.'); return eth.toDecimal(this) }"); \
frame->evaluateJavaScript("String.prototype.fix = function() { env.warn('THIS CALL IS DEPRECATED. USE eth.* INSTEAD.'); return eth.toFixed(this) }"); \
frame->evaluateJavaScript("String.prototype.sha3 = function() { env.warn('THIS CALL IS DEPRECATED. USE eth.* INSTEAD.'); return eth.sha3old(this) }"); \
frame->evaluateJavaScript("console.log = env.note"); \
frame->evaluateJavaScript("window.onerror = function (errorMsg, url, lineNumber, column, errorObj) { env.warn('Error: ' + errorMsg + ', Script: ' + url + ', Line: ' + lineNumber + ', Column: ' + column + ', StackTrace: ' + String(errorObj)) }"); \
frame->evaluateJavaScript("shh.makeWatch = function(a) { var ww = shh.newWatch(a); var ret = { w: ww }; ret.uninstall = function() { shh.killWatch(w); }; ret.changed = function(f) { shh.watchChanged.connect(function(nw) { if (nw == ww) f() }); }; ret.messages = function() { return JSON.parse(shh.watchMessages(this.w)) }; return ret; }"); \
frame->evaluateJavaScript("shh.watch = function(a) { return shh.makeWatch(JSON.stringify(a)) }"); \
}

18
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)

4
merge.sh

@ -0,0 +1,4 @@
#!/bin/bash
git checkout "$1+" && git merge --no-ff develop && git push && git tag -f $1 && git push --tags -f && git checkout develop

2
third/MainWin.cpp

@ -347,7 +347,7 @@ QString Main::lookup(QString const& _a) const
void Main::on_about_triggered()
{
QMessageBox::about(this, "About Third PoC-" + QString(dev::Version).section('.', 1, 1), QString("Third/v") + dev::Version + "/" DEV_QUOTED(ETH_BUILD_TYPE) "/" DEV_QUOTED(ETH_BUILD_PLATFORM) "\n" DEV_QUOTED(ETH_COMMIT_HASH) + (ETH_CLEAN_REPO ? "\nCLEAN" : "\n+ LOCAL CHANGES") + "\n\nBy Gav Wood, 2014.\nBased on a design by Vitalik Buterin.\n\nThanks to the various contributors including: Alex Leverington, Tim Hughes, caktux, Eric Lombrozo, Marko Simovic.");
QMessageBox::about(this, "About Third PoC-" + QString(dev::Version).section('.', 1, 1), QString("Third/v") + dev::Version + "/" DEV_QUOTED(ETH_BUILD_TYPE) "/" DEV_QUOTED(ETH_BUILD_PLATFORM) "\n" DEV_QUOTED(ETH_COMMIT_HASH) + (ETH_CLEAN_REPO ? "\nCLEAN" : "\n+ LOCAL CHANGES") + "\n\nBy Gav Wood, 2014.\nThis software wouldn't be where it is today without the many leaders & contributors including:\n\nVitalik Buterin, Tim Hughes, caktux, Nick Savers, Eric Lombrozo, Marko Simovic, the many testers and the Berlin \304\220\316\236V team.");
}
void Main::writeSettings()

240
windows/LibCryptoPP.vcxproj

@ -19,35 +19,275 @@
</ProjectConfiguration>
</ItemGroup>
<ItemGroup>
<ClCompile Include="..\..\cryptopp\adler32.cpp" />
<!--<ClCompile Include="..\..\cryptopp\algebra.cpp" />-->
<ClCompile Include="..\..\cryptopp\algparam.cpp" />
<ClCompile Include="..\..\cryptopp\arc4.cpp" />
<ClCompile Include="..\..\cryptopp\asn.cpp" />
<ClCompile Include="..\..\cryptopp\authenc.cpp" />
<ClCompile Include="..\..\cryptopp\base32.cpp" />
<ClCompile Include="..\..\cryptopp\base64.cpp" />
<ClCompile Include="..\..\cryptopp\basecode.cpp" />
<ClCompile Include="..\..\cryptopp\bench.cpp" />
<ClCompile Include="..\..\cryptopp\bench2.cpp" />
<ClCompile Include="..\..\cryptopp\bfinit.cpp" />
<ClCompile Include="..\..\cryptopp\blowfish.cpp" />
<ClCompile Include="..\..\cryptopp\blumshub.cpp" />
<ClCompile Include="..\..\cryptopp\camellia.cpp" />
<ClCompile Include="..\..\cryptopp\cast.cpp" />
<ClCompile Include="..\..\cryptopp\casts.cpp" />
<ClCompile Include="..\..\cryptopp\cbcmac.cpp" />
<ClCompile Include="..\..\cryptopp\ccm.cpp" />
<ClCompile Include="..\..\cryptopp\channels.cpp" />
<ClCompile Include="..\..\cryptopp\cmac.cpp" />
<ClCompile Include="..\..\cryptopp\cpu.cpp" />
<ClCompile Include="..\..\cryptopp\crc.cpp" />
<ClCompile Include="..\..\cryptopp\cryptlib.cpp" />
<ClCompile Include="..\..\cryptopp\cryptlib_bds.cpp" />
<ClCompile Include="..\..\cryptopp\datatest.cpp" />
<ClCompile Include="..\..\cryptopp\default.cpp" />
<ClCompile Include="..\..\cryptopp\des.cpp" />
<ClCompile Include="..\..\cryptopp\dessp.cpp" />
<ClCompile Include="..\..\cryptopp\dh.cpp" />
<ClCompile Include="..\..\cryptopp\dh2.cpp" />
<ClCompile Include="..\..\cryptopp\dll.cpp" />
<ClCompile Include="..\..\cryptopp\dlltest.cpp" />
<ClCompile Include="..\..\cryptopp\dsa.cpp" />
<ClCompile Include="..\..\cryptopp\eax.cpp" />
<ClCompile Include="..\..\cryptopp\ec2n.cpp" />
<!--<ClCompile Include="..\..\cryptopp\eccrypto.cpp" />-->
<ClCompile Include="..\..\cryptopp\ecp.cpp" />
<ClCompile Include="..\..\cryptopp\elgamal.cpp" />
<ClCompile Include="..\..\cryptopp\emsa2.cpp" />
<!--<ClCompile Include="..\..\cryptopp\eprecomp.cpp" />-->
<ClCompile Include="..\..\cryptopp\esign.cpp" />
<ClCompile Include="..\..\cryptopp\files.cpp" />
<ClCompile Include="..\..\cryptopp\filters.cpp" />
<ClCompile Include="..\..\cryptopp\fips140.cpp" />
<ClCompile Include="..\..\cryptopp\fipsalgt.cpp" />
<!--<ClCompile Include="..\..\cryptopp\fipstest.cpp" />-->
<ClCompile Include="..\..\cryptopp\gcm.cpp" />
<ClCompile Include="..\..\cryptopp\gf256.cpp" />
<ClCompile Include="..\..\cryptopp\gf2_32.cpp" />
<ClCompile Include="..\..\cryptopp\gf2n.cpp" />
<ClCompile Include="..\..\cryptopp\gfpcrypt.cpp" />
<ClCompile Include="..\..\cryptopp\gost.cpp" />
<ClCompile Include="..\..\cryptopp\gzip.cpp" />
<ClCompile Include="..\..\cryptopp\hex.cpp" />
<ClCompile Include="..\..\cryptopp\hmac.cpp" />
<ClCompile Include="..\..\cryptopp\hrtimer.cpp" />
<ClCompile Include="..\..\cryptopp\ida.cpp" />
<ClCompile Include="..\..\cryptopp\idea.cpp" />
<ClCompile Include="..\..\cryptopp\integer.cpp" />
<ClCompile Include="..\..\cryptopp\iterhash.cpp" />
<ClCompile Include="..\..\cryptopp\luc.cpp" />
<ClCompile Include="..\..\cryptopp\mars.cpp" />
<ClCompile Include="..\..\cryptopp\marss.cpp" />
<ClCompile Include="..\..\cryptopp\md2.cpp" />
<ClCompile Include="..\..\cryptopp\md4.cpp" />
<ClCompile Include="..\..\cryptopp\md5.cpp" />
<ClCompile Include="..\..\cryptopp\misc.cpp" />
<ClCompile Include="..\..\cryptopp\modes.cpp" />
<ClCompile Include="..\..\cryptopp\mqueue.cpp" />
<ClCompile Include="..\..\cryptopp\mqv.cpp" />
<ClCompile Include="..\..\cryptopp\nbtheory.cpp" />
<ClCompile Include="..\..\cryptopp\network.cpp" />
<ClCompile Include="..\..\cryptopp\oaep.cpp" />
<ClCompile Include="..\..\cryptopp\osrng.cpp" />
<ClCompile Include="..\..\cryptopp\panama.cpp" />
<ClCompile Include="..\..\cryptopp\pch.cpp" />
<ClCompile Include="..\..\cryptopp\pkcspad.cpp" />
<!--<ClCompile Include="..\..\cryptopp\polynomi.cpp" />-->
<ClCompile Include="..\..\cryptopp\pssr.cpp" />
<ClCompile Include="..\..\cryptopp\pubkey.cpp" />
<ClCompile Include="..\..\cryptopp\queue.cpp" />
<ClCompile Include="..\..\cryptopp\rabin.cpp" />
<ClCompile Include="..\..\cryptopp\randpool.cpp" />
<ClCompile Include="..\..\cryptopp\rc2.cpp" />
<ClCompile Include="..\..\cryptopp\rc5.cpp" />
<ClCompile Include="..\..\cryptopp\rc6.cpp" />
<ClCompile Include="..\..\cryptopp\rdtables.cpp" />
<ClCompile Include="..\..\cryptopp\regtest.cpp" />
<ClCompile Include="..\..\cryptopp\rijndael.cpp" />
<ClCompile Include="..\..\cryptopp\ripemd.cpp" />
<ClCompile Include="..\..\cryptopp\rng.cpp" />
<ClCompile Include="..\..\cryptopp\rsa.cpp" />
<ClCompile Include="..\..\cryptopp\rw.cpp" />
<ClCompile Include="..\..\cryptopp\safer.cpp" />
<ClCompile Include="..\..\cryptopp\salsa.cpp" />
<ClCompile Include="..\..\cryptopp\seal.cpp" />
<ClCompile Include="..\..\cryptopp\seed.cpp" />
<ClCompile Include="..\..\cryptopp\serpent.cpp" />
<ClCompile Include="..\..\cryptopp\sha.cpp" />
<ClCompile Include="..\..\cryptopp\sha3.cpp" />
<ClCompile Include="..\..\cryptopp\shacal2.cpp" />
<ClCompile Include="..\..\cryptopp\shark.cpp" />
<ClCompile Include="..\..\cryptopp\sharkbox.cpp" />
<!--<ClCompile Include="..\..\cryptopp\simple.cpp" />-->
<ClCompile Include="..\..\cryptopp\skipjack.cpp" />
<!--<ClCompile Include="..\..\cryptopp\socketft.cpp" />-->
<ClCompile Include="..\..\cryptopp\sosemanuk.cpp" />
<ClCompile Include="..\..\cryptopp\square.cpp" />
<ClCompile Include="..\..\cryptopp\squaretb.cpp" />
<!--<ClCompile Include="..\..\cryptopp\strciphr.cpp" />-->
<ClCompile Include="..\..\cryptopp\tea.cpp" />
<ClCompile Include="..\..\cryptopp\test.cpp" />
<ClCompile Include="..\..\cryptopp\tftables.cpp" />
<ClCompile Include="..\..\cryptopp\tiger.cpp" />
<ClCompile Include="..\..\cryptopp\tigertab.cpp" />
<ClCompile Include="..\..\cryptopp\trdlocal.cpp" />
<ClCompile Include="..\..\cryptopp\ttmac.cpp" />
<ClCompile Include="..\..\cryptopp\twofish.cpp" />
<ClCompile Include="..\..\cryptopp\validat1.cpp" />
<ClCompile Include="..\..\cryptopp\validat2.cpp" />
<ClCompile Include="..\..\cryptopp\validat3.cpp" />
<ClCompile Include="..\..\cryptopp\vmac.cpp" />
<ClCompile Include="..\..\cryptopp\wait.cpp" />
<ClCompile Include="..\..\cryptopp\wake.cpp" />
<ClCompile Include="..\..\cryptopp\whrlpool.cpp" />
<ClCompile Include="..\..\cryptopp\winpipes.cpp" />
<ClCompile Include="..\..\cryptopp\xtr.cpp" />
<ClCompile Include="..\..\cryptopp\xtrcrypt.cpp" />
<ClCompile Include="..\..\cryptopp\zdeflate.cpp" />
<ClCompile Include="..\..\cryptopp\zinflate.cpp" />
<ClCompile Include="..\..\cryptopp\zlib.cpp" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="..\..\cryptopp\3way.h" />
<ClInclude Include="..\..\cryptopp\adler32.h" />
<ClInclude Include="..\..\cryptopp\aes.h" />
<ClInclude Include="..\..\cryptopp\algebra.h" />
<ClInclude Include="..\..\cryptopp\algparam.h" />
<ClInclude Include="..\..\cryptopp\arc4.h" />
<ClInclude Include="..\..\cryptopp\argnames.h" />
<ClInclude Include="..\..\cryptopp\asn.h" />
<ClInclude Include="..\..\cryptopp\authenc.h" />
<ClInclude Include="..\..\cryptopp\base32.h" />
<ClInclude Include="..\..\cryptopp\base64.h" />
<ClInclude Include="..\..\cryptopp\basecode.h" />
<ClInclude Include="..\..\cryptopp\bench.h" />
<ClInclude Include="..\..\cryptopp\blowfish.h" />
<ClInclude Include="..\..\cryptopp\blumshub.h" />
<ClInclude Include="..\..\cryptopp\camellia.h" />
<ClInclude Include="..\..\cryptopp\cast.h" />
<ClInclude Include="..\..\cryptopp\cbcmac.h" />
<ClInclude Include="..\..\cryptopp\ccm.h" />
<ClInclude Include="..\..\cryptopp\channels.h" />
<ClInclude Include="..\..\cryptopp\cmac.h" />
<ClInclude Include="..\..\cryptopp\config.h" />
<ClInclude Include="..\..\cryptopp\cpu.h" />
<ClInclude Include="..\..\cryptopp\crc.h" />
<ClInclude Include="..\..\cryptopp\cryptlib.h" />
<ClInclude Include="..\..\cryptopp\default.h" />
<ClInclude Include="..\..\cryptopp\des.h" />
<ClInclude Include="..\..\cryptopp\dh.h" />
<ClInclude Include="..\..\cryptopp\dh2.h" />
<ClInclude Include="..\..\cryptopp\dll.h" />
<ClInclude Include="..\..\cryptopp\dmac.h" />
<ClInclude Include="..\..\cryptopp\dsa.h" />
<ClInclude Include="..\..\cryptopp\eax.h" />
<ClInclude Include="..\..\cryptopp\ec2n.h" />
<ClInclude Include="..\..\cryptopp\eccrypto.h" />
<ClInclude Include="..\..\cryptopp\ecp.h" />
<ClInclude Include="..\..\cryptopp\elgamal.h" />
<ClInclude Include="..\..\cryptopp\emsa2.h" />
<ClInclude Include="..\..\cryptopp\eprecomp.h" />
<ClInclude Include="..\..\cryptopp\esign.h" />
<ClInclude Include="..\..\cryptopp\factory.h" />
<ClInclude Include="..\..\cryptopp\files.h" />
<ClInclude Include="..\..\cryptopp\filters.h" />
<ClInclude Include="..\..\cryptopp\fips140.h" />
<ClInclude Include="..\..\cryptopp\fltrimpl.h" />
<ClInclude Include="..\..\cryptopp\gcm.h" />
<ClInclude Include="..\..\cryptopp\gf256.h" />
<ClInclude Include="..\..\cryptopp\gf2_32.h" />
<ClInclude Include="..\..\cryptopp\gf2n.h" />
<ClInclude Include="..\..\cryptopp\gfpcrypt.h" />
<ClInclude Include="..\..\cryptopp\gost.h" />
<ClInclude Include="..\..\cryptopp\gzip.h" />
<ClInclude Include="..\..\cryptopp\hex.h" />
<ClInclude Include="..\..\cryptopp\hmac.h" />
<ClInclude Include="..\..\cryptopp\hrtimer.h" />
<ClInclude Include="..\..\cryptopp\ida.h" />
<ClInclude Include="..\..\cryptopp\idea.h" />
<ClInclude Include="..\..\cryptopp\integer.h" />
<ClInclude Include="..\..\cryptopp\iterhash.h" />
<!--<ClInclude Include="..\..\cryptopp\lubyrack.h" />-->
<ClInclude Include="..\..\cryptopp\luc.h" />
<ClInclude Include="..\..\cryptopp\mars.h" />
<ClInclude Include="..\..\cryptopp\md2.h" />
<ClInclude Include="..\..\cryptopp\md4.h" />
<ClInclude Include="..\..\cryptopp\md5.h" />
<!--<ClInclude Include="..\..\cryptopp\mdc.h" />-->
<ClInclude Include="..\..\cryptopp\misc.h" />
<ClInclude Include="..\..\cryptopp\modarith.h" />
<ClInclude Include="..\..\cryptopp\modes.h" />
<ClInclude Include="..\..\cryptopp\modexppc.h" />
<ClInclude Include="..\..\cryptopp\mqueue.h" />
<ClInclude Include="..\..\cryptopp\mqv.h" />
<ClInclude Include="..\..\cryptopp\nbtheory.h" />
<ClInclude Include="..\..\cryptopp\network.h" />
<ClInclude Include="..\..\cryptopp\nr.h" />
<ClInclude Include="..\..\cryptopp\oaep.h" />
<ClInclude Include="..\..\cryptopp\oids.h" />
<ClInclude Include="..\..\cryptopp\osrng.h" />
<ClInclude Include="..\..\cryptopp\panama.h" />
<ClInclude Include="..\..\cryptopp\pch.h" />
<ClInclude Include="..\..\cryptopp\pkcspad.h" />
<ClInclude Include="..\..\cryptopp\polynomi.h" />
<ClInclude Include="..\..\cryptopp\pssr.h" />
<ClInclude Include="..\..\cryptopp\pubkey.h" />
<ClInclude Include="..\..\cryptopp\pwdbased.h" />
<ClInclude Include="..\..\cryptopp\queue.h" />
<ClInclude Include="..\..\cryptopp\rabin.h" />
<ClInclude Include="..\..\cryptopp\randpool.h" />
<ClInclude Include="..\..\cryptopp\rc2.h" />
<ClInclude Include="..\..\cryptopp\rc5.h" />
<ClInclude Include="..\..\cryptopp\rc6.h" />
<ClInclude Include="..\..\cryptopp\resource.h" />
<ClInclude Include="..\..\cryptopp\rijndael.h" />
<ClInclude Include="..\..\cryptopp\ripemd.h" />
<ClInclude Include="..\..\cryptopp\rng.h" />
<ClInclude Include="..\..\cryptopp\rsa.h" />
<ClInclude Include="..\..\cryptopp\rw.h" />
<ClInclude Include="..\..\cryptopp\safer.h" />
<ClInclude Include="..\..\cryptopp\salsa.h" />
<ClInclude Include="..\..\cryptopp\seal.h" />
<ClInclude Include="..\..\cryptopp\secblock.h" />
<ClInclude Include="..\..\cryptopp\seckey.h" />
<ClInclude Include="..\..\cryptopp\seed.h" />
<ClInclude Include="..\..\cryptopp\serpent.h" />
<!--<ClInclude Include="..\..\cryptopp\serpentp.h" />-->
<ClInclude Include="..\..\cryptopp\sha.h" />
<ClInclude Include="..\..\cryptopp\sha3.h" />
<ClInclude Include="..\..\cryptopp\shacal2.h" />
<ClInclude Include="..\..\cryptopp\shark.h" />
<ClInclude Include="..\..\cryptopp\simple.h" />
<ClInclude Include="..\..\cryptopp\skipjack.h" />
<ClInclude Include="..\..\cryptopp\smartptr.h" />
<ClInclude Include="..\..\cryptopp\socketft.h" />
<ClInclude Include="..\..\cryptopp\sosemanuk.h" />
<ClInclude Include="..\..\cryptopp\square.h" />
<ClInclude Include="..\..\cryptopp\stdcpp.h" />
<ClInclude Include="..\..\cryptopp\strciphr.h" />
<ClInclude Include="..\..\cryptopp\tea.h" />
<ClInclude Include="..\..\cryptopp\tiger.h" />
<ClInclude Include="..\..\cryptopp\trdlocal.h" />
<ClInclude Include="..\..\cryptopp\trunhash.h" />
<ClInclude Include="..\..\cryptopp\ttmac.h" />
<ClInclude Include="..\..\cryptopp\twofish.h" />
<ClInclude Include="..\..\cryptopp\validate.h" />
<ClInclude Include="..\..\cryptopp\vmac.h" />
<ClInclude Include="..\..\cryptopp\wait.h" />
<ClInclude Include="..\..\cryptopp\wake.h" />
<ClInclude Include="..\..\cryptopp\whrlpool.h" />
<ClInclude Include="..\..\cryptopp\winpipes.h" />
<ClInclude Include="..\..\cryptopp\words.h" />
<ClInclude Include="..\..\cryptopp\xtr.h" />
<ClInclude Include="..\..\cryptopp\xtrcrypt.h" />
<ClInclude Include="..\..\cryptopp\zdeflate.h" />
<ClInclude Include="..\..\cryptopp\zinflate.h" />
<ClInclude Include="..\..\cryptopp\zlib.h" />
</ItemGroup>
<ItemGroup>
<CustomBuild Include="..\..\cryptopp\x64dll.asm">

Loading…
Cancel
Save