From 702e92794593d2c057f2ff854ace1b073d1eec9c Mon Sep 17 00:00:00 2001 From: Gav Wood Date: Mon, 22 Sep 2014 17:15:11 -0500 Subject: [PATCH 01/11] Minor UI stuff. --- alethzero/Main.ui | 32 +++++++++++++++++++++++++------- alethzero/MainWin.cpp | 26 ++++++++++++++++++++++++++ alethzero/MainWin.h | 2 ++ 3 files changed, 53 insertions(+), 7 deletions(-) diff --git a/alethzero/Main.ui b/alethzero/Main.ui index dbc4bb144..5c0f50a6d 100644 --- a/alethzero/Main.ui +++ b/alethzero/Main.ui @@ -130,6 +130,8 @@ &Network + + @@ -141,15 +143,12 @@ T&ools - + - - - @@ -191,7 +190,17 @@ + + + &View + + + + + + + @@ -507,8 +516,7 @@ false - - + @@ -1521,7 +1529,7 @@ font-size: 14pt true - &Preview + &Preview Pending Transactions @@ -1740,6 +1748,16 @@ font-size: 14pt Enable Local Addresses + + + Import Key &File... + + + + + Go! + + diff --git a/alethzero/MainWin.cpp b/alethzero/MainWin.cpp index b4bbb8ca7..3e7df750b 100644 --- a/alethzero/MainWin.cpp +++ b/alethzero/MainWin.cpp @@ -570,6 +570,26 @@ void Main::on_importKey_triggered() QMessageBox::warning(this, "Invalid Entry", "Could not import the secret key; invalid key entered. Make sure it is 64 hex characters (0-9 or A-F)."); } +void Main::on_importKeyFile_triggered() +{ + QString s = QFileDialog::getOpenFileName(this, "Import Account", QDir::homePath(), "JSON Files (*.json);;All Files (*)"); + bytes b = fromHex(s.toStdString()); + if (b.size() == 32) + { + auto k = KeyPair(h256(b)); + if (std::find(m_myKeys.begin(), m_myKeys.end(), k) == m_myKeys.end()) + { + m_myKeys.append(k); + m_keysChanged = true; + update(); + } + else + QMessageBox::warning(this, "Already Have Key", "Could not import the secret key: we already own this account."); + } + else + QMessageBox::warning(this, "Invalid Entry", "Could not import the secret key; invalid key entered. Make sure it is 64 hex characters (0-9 or A-F)."); +} + void Main::on_exportKey_triggered() { if (ui->ourAccounts->currentRow() >= 0 && ui->ourAccounts->currentRow() < m_myKeys.size()) @@ -1689,6 +1709,12 @@ void Main::on_dumpTraceStorage_triggered() } } +void Main::on_go_triggered() +{ + ui->net->setChecked(true); + web3()->connect(Host::pocHost()); +} + void Main::on_callStack_currentItemChanged() { updateDebugger(); diff --git a/alethzero/MainWin.h b/alethzero/MainWin.h index ce1a9b670..eab135133 100644 --- a/alethzero/MainWin.h +++ b/alethzero/MainWin.h @@ -144,6 +144,8 @@ private slots: void on_usePrivate_triggered(); void on_enableOptimizer_triggered(); void on_turboMining_triggered(); + void on_go_triggered(); + void on_importKeyFile_triggered(); signals: void poll(); From 9882e98606537a392ee7ae6f99d6d46e417fb7c2 Mon Sep 17 00:00:00 2001 From: Gav Wood Date: Mon, 22 Sep 2014 18:02:07 -0500 Subject: [PATCH 02/11] Helpers and fixes for uncles debugging. --- libethcore/Exceptions.h | 2 +- libethereum/State.cpp | 7 ++++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/libethcore/Exceptions.h b/libethcore/Exceptions.h index c936b1f1b..8a15cd80f 100644 --- a/libethcore/Exceptions.h +++ b/libethcore/Exceptions.h @@ -25,7 +25,7 @@ class InvalidBlockHeaderFormat: public dev::Exception { public: InvalidBlockHead class InvalidUnclesHash: public dev::Exception {}; class InvalidUncle: public dev::Exception {}; class UncleTooOld: public dev::Exception {}; -class UncleInChain: public dev::Exception {}; +class UncleInChain: public dev::Exception { public: UncleInChain(h256Set _uncles, h256 _block): m_uncles(_uncles), m_block(_block) {} h256Set m_uncles; h256 m_block; virtual std::string description() const { return "Uncle in block already mentioned: Uncles " + toString(m_uncles) + " (" + m_block.abridged() + ")"; } }; class DuplicateUncleNonce: public dev::Exception {}; class InvalidStateRoot: public dev::Exception {}; class InvalidTransactionsHash: public dev::Exception { public: InvalidTransactionsHash(h256 _head, h256 _real): m_head(_head), m_real(_real) {} h256 m_head; h256 m_real; virtual std::string description() const { return "Invalid transactions hash: header says: " + toHex(m_head.ref()) + " block is:" + toHex(m_real.ref()); } }; diff --git a/libethereum/State.cpp b/libethereum/State.cpp index a74b6ba18..8fa6141a5 100644 --- a/libethereum/State.cpp +++ b/libethereum/State.cpp @@ -577,6 +577,9 @@ u256 State::enact(bytesConstRef _block, BlockChain const* _bc, bool _checkNonce) set knownUncles = _bc ? _bc->allUnclesFrom(m_currentBlock.parentHash) : set(); for (auto const& i: RLP(_block)[2]) { + if (knownUncles.count(sha3(i.data()))) + throw UncleInChain(knownUncles, sha3(i.data())); + BlockInfo uncle = BlockInfo::fromHeader(i.data()); if (nonces.count(uncle.nonce)) throw DuplicateUncleNonce(); @@ -585,8 +588,6 @@ u256 State::enact(bytesConstRef _block, BlockChain const* _bc, bool _checkNonce) BlockInfo uncleParent(_bc->block(uncle.parentHash)); if ((bigint)uncleParent.number < (bigint)m_currentBlock.number - 6) throw UncleTooOld(); - if (knownUncles.count(sha3(i.data()))) - throw UncleInChain(); uncle.verifyParent(uncleParent); } @@ -725,7 +726,7 @@ void State::commitToMine(BlockChain const& _bc) auto us = _bc.details(p).children; assert(us.size() >= 1); // must be at least 1 child of our grandparent - it's our own parent! for (auto const& u: us) - if (!knownUncles.count(BlockInfo::headerHash(_bc.block(u)))) // ignore any uncles/mainline blocks that we know about. We use header-hash for this. + if (!knownUncles.count(u)) // ignore any uncles/mainline blocks that we know about. { BlockInfo ubi(_bc.block(u)); ubi.fillStream(unclesData, true); From 6777a24b1ed92d839d93c046bbe6835a6fd11475 Mon Sep 17 00:00:00 2001 From: Gav Wood Date: Mon, 22 Sep 2014 18:24:32 -0500 Subject: [PATCH 03/11] Stop fetching once fetch is decidedly bad. --- libethereum/DownloadMan.h | 11 +++++++++++ libethereum/EthereumHost.cpp | 2 ++ 2 files changed, 13 insertions(+) diff --git a/libethereum/DownloadMan.h b/libethereum/DownloadMan.h index e67076d5a..3b88040fd 100644 --- a/libethereum/DownloadMan.h +++ b/libethereum/DownloadMan.h @@ -101,6 +101,17 @@ public: m_blocksGot = RangeMask(0, m_chain.size()); } + void reset() + { + { + ReadGuard l(x_subs); + for (auto i: m_subs) + i->resetFetch(); + } + m_chain.clear(); + m_blocksGot.clear(); + } + RangeMask taken(bool _desperate = false) const { auto ret = m_blocksGot; diff --git a/libethereum/EthereumHost.cpp b/libethereum/EthereumHost.cpp index f9fe45eb0..74a33f9d5 100644 --- a/libethereum/EthereumHost.cpp +++ b/libethereum/EthereumHost.cpp @@ -149,6 +149,7 @@ void EthereumHost::noteDoneBlocks(EthereumPeer* _who) // Done our chain-get. clog(NetNote) << "Chain download complete."; updateGrabbing(Grabbing::Nothing); + m_man.reset(); } if (_who->m_grabbing == Grabbing::Chain) { @@ -156,6 +157,7 @@ void EthereumHost::noteDoneBlocks(EthereumPeer* _who) clog(NetNote) << "Chain download failed. Peer with blocks didn't have them all. This peer is bad and should be punished."; // TODO: note that peer is BADBADBAD! updateGrabbing(Grabbing::Nothing); + m_man.reset(); } } From e03a663d97fcc51538e8d2eca0d4f70c941e16fd Mon Sep 17 00:00:00 2001 From: Gav Wood Date: Mon, 22 Sep 2014 18:51:36 -0500 Subject: [PATCH 04/11] Actually stop getting chain once no more to grab. --- libethereum/EthereumPeer.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/libethereum/EthereumPeer.cpp b/libethereum/EthereumPeer.cpp index 7608afc2a..67721a083 100644 --- a/libethereum/EthereumPeer.cpp +++ b/libethereum/EthereumPeer.cpp @@ -246,6 +246,7 @@ bool EthereumPeer::interpret(RLP const& _r) // Couldn't get any from last batch - probably got to this peer's latest block - just give up. m_sub.doneFetch(); giveUpOnFetch(); + break; } unsigned used = 0; From 137c22597f2a6a5cced2f5608a5ed89892fff32c Mon Sep 17 00:00:00 2001 From: Gav Wood Date: Tue, 30 Sep 2014 10:27:02 +0100 Subject: [PATCH 05/11] Make net button work. --- alethzero/MainWin.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/alethzero/MainWin.cpp b/alethzero/MainWin.cpp index 3e7df750b..664a7f734 100644 --- a/alethzero/MainWin.cpp +++ b/alethzero/MainWin.cpp @@ -1711,7 +1711,11 @@ void Main::on_dumpTraceStorage_triggered() void Main::on_go_triggered() { - ui->net->setChecked(true); + if (!ui->net->isChecked()) + { + ui->net->setChecked(true); + on_net_triggered(); + } web3()->connect(Host::pocHost()); } From 3cb6af930fb47311f4fd88956298f2a92ebc15ad Mon Sep 17 00:00:00 2001 From: Gav Wood Date: Tue, 30 Sep 2014 14:06:52 +0100 Subject: [PATCH 06/11] Fix for wierd empty blocks. --- libethereum/BlockChain.cpp | 12 +++++++++--- libethereum/EthereumPeer.cpp | 2 +- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/libethereum/BlockChain.cpp b/libethereum/BlockChain.cpp index 79cccd4ef..ae628dba6 100644 --- a/libethereum/BlockChain.cpp +++ b/libethereum/BlockChain.cpp @@ -276,7 +276,10 @@ h256s BlockChain::import(bytes const& _block, OverlayDB const& _db) auto pd = details(bi.parentHash); if (!pd) + { cwarn << "Odd: details is returning false despite block known:" << RLP(pd.rlp()); + cwarn << "Block:" << RLP(block(bi.parentHash)); + } // Check it's not crazy if (bi.timestamp > (u256)time(0)) @@ -479,13 +482,16 @@ bytes BlockChain::block(h256 _hash) const string d; m_db->Get(m_readOptions, ldb::Slice((char const*)&_hash, 32), &d); + if (!d.size()) + { + cwarn << "Couldn't find requested block:" << _hash.abridged(); + return d; + } + WriteGuard l(x_cache); m_cache[_hash].resize(d.size()); memcpy(m_cache[_hash].data(), d.data(), d.size()); - if (!d.size()) - cwarn << "Couldn't find requested block:" << _hash.abridged(); - return m_cache[_hash]; } diff --git a/libethereum/EthereumPeer.cpp b/libethereum/EthereumPeer.cpp index 67721a083..7950c489f 100644 --- a/libethereum/EthereumPeer.cpp +++ b/libethereum/EthereumPeer.cpp @@ -203,7 +203,7 @@ bool EthereumPeer::interpret(RLP const& _r) for (unsigned i = 1; i < _r.itemCount(); ++i) { auto h = _r[i].toHash(); - if (host()->m_chain.details(h)) + if (host()->m_chain.isKnown(h)) { host()->noteHaveChain(this); return true; From f83b8d795e1c1fd28c8e6eef798d35633e6e2a6c Mon Sep 17 00:00:00 2001 From: Gav Wood Date: Tue, 30 Sep 2014 14:07:12 +0100 Subject: [PATCH 07/11] Quick build fix. --- libethereum/BlockChain.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libethereum/BlockChain.cpp b/libethereum/BlockChain.cpp index ae628dba6..f375adfcb 100644 --- a/libethereum/BlockChain.cpp +++ b/libethereum/BlockChain.cpp @@ -485,7 +485,7 @@ bytes BlockChain::block(h256 _hash) const if (!d.size()) { cwarn << "Couldn't find requested block:" << _hash.abridged(); - return d; + return bytes(); } WriteGuard l(x_cache); From 340801ed907dc15b4f9c15dc46f93ffd93200fcf Mon Sep 17 00:00:00 2001 From: Gav Wood Date: Tue, 30 Sep 2014 15:53:15 +0100 Subject: [PATCH 08/11] Networking fixes. --- alethzero/MainWin.cpp | 2 +- libdevcore/Common.cpp | 2 +- libethereum/EthereumHost.cpp | 2 ++ libethereum/EthereumPeer.cpp | 3 ++- libp2p/Common.h | 1 + libp2p/Session.cpp | 4 ++-- test/TestHelper.cpp | 2 ++ 7 files changed, 11 insertions(+), 5 deletions(-) diff --git a/alethzero/MainWin.cpp b/alethzero/MainWin.cpp index 664a7f734..14fbf003f 100644 --- a/alethzero/MainWin.cpp +++ b/alethzero/MainWin.cpp @@ -711,7 +711,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("%3 ms - %1:%2 - %4 %5").arg(i.host.c_str()).arg(i.port).arg(chrono::duration_cast(i.lastPing).count()).arg(i.clientVersion.c_str()).arg(QString::fromStdString(toString(i.caps)))); + ui->peers->addItem(QString("[%6] %3 ms - %1:%2 - %4 %5").arg(i.host.c_str()).arg(i.port).arg(chrono::duration_cast(i.lastPing).count()).arg(i.clientVersion.c_str()).arg(QString::fromStdString(toString(i.caps))).arg(i.socket)); } void Main::refreshAll() diff --git a/libdevcore/Common.cpp b/libdevcore/Common.cpp index 8312960c1..bc903b52d 100644 --- a/libdevcore/Common.cpp +++ b/libdevcore/Common.cpp @@ -27,7 +27,7 @@ using namespace dev; namespace dev { -char const* Version = "0.6.9"; +char const* Version = "0.6.10"; } diff --git a/libethereum/EthereumHost.cpp b/libethereum/EthereumHost.cpp index 74a33f9d5..eea3fd5af 100644 --- a/libethereum/EthereumHost.cpp +++ b/libethereum/EthereumHost.cpp @@ -265,6 +265,8 @@ void EthereumHost::maintainBlocks(BlockQueue& _bq, h256 _currentHash) ++c; } 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?"; ts.appendList(1 + c).append(BlocksPacket).appendRaw(bs, c); bytes b; ts.swapOut(b); diff --git a/libethereum/EthereumPeer.cpp b/libethereum/EthereumPeer.cpp index 7950c489f..fb2558d57 100644 --- a/libethereum/EthereumPeer.cpp +++ b/libethereum/EthereumPeer.cpp @@ -264,7 +264,8 @@ bool EthereumPeer::interpret(RLP const& _r) unsigned unknownParents = 0; if (g_logVerbosity >= NetMessageSummary::verbosity) { - for (unsigned i = 1; i < _r.itemCount(); ++i) + unsigned ic = _r.itemCount(); + for (unsigned i = 1; i < ic; ++i) { auto h = BlockInfo::headerHash(_r[i].data()); BlockInfo bi(_r[i].data()); diff --git a/libp2p/Common.h b/libp2p/Common.h index a83ac03de..3339df8bb 100644 --- a/libp2p/Common.h +++ b/libp2p/Common.h @@ -95,6 +95,7 @@ struct PeerInfo unsigned short port; std::chrono::steady_clock::duration lastPing; std::set caps; + unsigned socket; }; } diff --git a/libp2p/Session.cpp b/libp2p/Session.cpp index 2dc60e0de..e449d03b7 100644 --- a/libp2p/Session.cpp +++ b/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)}); + m_info = PeerInfo({"?", _peerAddress.to_string(), m_listenPort, std::chrono::steady_clock::duration(0), set(), 0}); } 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()}); } + { m_info = PeerInfo({clientVersion, m_socket.remote_endpoint().address().to_string(), m_listenPort, std::chrono::steady_clock::duration(), _r[3].toSet(), (unsigned)m_socket.native_handle()}); } catch (...) { disconnect(BadProtocol); diff --git a/test/TestHelper.cpp b/test/TestHelper.cpp index 20c42a9b8..03e679343 100644 --- a/test/TestHelper.cpp +++ b/test/TestHelper.cpp @@ -42,6 +42,8 @@ void mine(Client& c, int numBlocks) void connectClients(Client& c1, Client& c2) { + (void)c1; + (void)c2; // TODO: Move to WebThree. eth::Client no longer handles networking. #if 0 short c1Port = 20000; From 9ce2b5bfa69beeff0b8d36da8fa66cd5ea0b3e88 Mon Sep 17 00:00:00 2001 From: Gav Wood Date: Tue, 30 Sep 2014 18:25:10 +0100 Subject: [PATCH 09/11] Avoid attempt to reget chain on block reception. Send genesis block hash in hash chain. --- alethzero/MainWin.cpp | 33 ++++++++++++++++++++++++++++----- libethereum/DownloadMan.cpp | 2 +- libethereum/EthereumPeer.cpp | 4 ++-- test/rlp.cpp | 2 +- 4 files changed, 32 insertions(+), 9 deletions(-) diff --git a/alethzero/MainWin.cpp b/alethzero/MainWin.cpp index 14fbf003f..18b327999 100644 --- a/alethzero/MainWin.cpp +++ b/alethzero/MainWin.cpp @@ -28,6 +28,7 @@ #include #include #include +#include #include #include #include @@ -49,6 +50,7 @@ using namespace std; using namespace dev; using namespace dev::p2p; using namespace dev::eth; +namespace js = json_spirit; static void initUnits(QComboBox* _b) { @@ -573,10 +575,29 @@ void Main::on_importKey_triggered() void Main::on_importKeyFile_triggered() { QString s = QFileDialog::getOpenFileName(this, "Import Account", QDir::homePath(), "JSON Files (*.json);;All Files (*)"); - bytes b = fromHex(s.toStdString()); - if (b.size() == 32) + try { - auto k = KeyPair(h256(b)); + js::mValue val; + json_spirit::read_string(asString(contents(s.toStdString())), val); + js::mObject obj = val.get_obj(); + KeyPair k; + + if (obj["encseed"].type() == js::str_type) + { + string encseedstr = obj["encseed"].get_str(); + bytes encseed = fromHex(encseedstr); + Secret sec = sha3(encseed); + k = KeyPair(sec); + if (obj["ethaddr"].type() == js::str_type) + { + 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; + } + } + else + throw 0; if (std::find(m_myKeys.begin(), m_myKeys.end(), k) == m_myKeys.end()) { m_myKeys.append(k); @@ -586,8 +607,10 @@ void Main::on_importKeyFile_triggered() else QMessageBox::warning(this, "Already Have Key", "Could not import the secret key: we already own this account."); } - else - QMessageBox::warning(this, "Invalid Entry", "Could not import the secret key; invalid key entered. Make sure it is 64 hex characters (0-9 or A-F)."); + catch (...) + { + QMessageBox::warning(this, "Key File Invalid", "Could not find secret key definition. This is probably not an Ethereum key file."); + } } void Main::on_exportKey_triggered() diff --git a/libethereum/DownloadMan.cpp b/libethereum/DownloadMan.cpp index 09a3bcc00..3c8dae58e 100644 --- a/libethereum/DownloadMan.cpp +++ b/libethereum/DownloadMan.cpp @@ -50,7 +50,7 @@ h256Set DownloadSub::nextFetch(unsigned _n) m_indices.clear(); m_remaining.clear(); - if (!m_man) + if (!m_man || m_man->chain().empty()) return h256Set(); m_asked = (~(m_man->taken() + m_attempted)).lowest(_n); diff --git a/libethereum/EthereumPeer.cpp b/libethereum/EthereumPeer.cpp index fb2558d57..99ff41bad 100644 --- a/libethereum/EthereumPeer.cpp +++ b/libethereum/EthereumPeer.cpp @@ -176,12 +176,12 @@ bool EthereumPeer::interpret(RLP const& _r) unsigned limit = _r[2].toInt(); clogS(NetMessageSummary) << "GetBlockHashes (" << limit << "entries," << later.abridged() << ")"; - unsigned c = min(max(1, host()->m_chain.number(later)) - 1, limit); + unsigned c = min(host()->m_chain.number(later), limit); RLPStream s; prep(s).appendList(1 + c).append(BlockHashesPacket); h256 p = host()->m_chain.details(later).parent; - for (unsigned i = 0; i < c; ++i, p = host()->m_chain.details(p).parent) + for (unsigned i = 0; i < c && p; ++i, p = host()->m_chain.details(p).parent) s << p; sealAndSend(s); break; diff --git a/test/rlp.cpp b/test/rlp.cpp index b51f3a225..c3f9dda2f 100644 --- a/test/rlp.cpp +++ b/test/rlp.cpp @@ -22,12 +22,12 @@ #include #include -#include "JsonSpiritHeaders.h" #include #include #include #include #include +#include "JsonSpiritHeaders.h" using namespace std; using namespace dev; From 36215b3a8c625ffdcd3c6db5cb57b03f5858eca1 Mon Sep 17 00:00:00 2001 From: Gav Wood Date: Tue, 30 Sep 2014 19:25:41 +0100 Subject: [PATCH 10/11] Reorganisation of UI. --- alethzero/Main.ui | 46 +++++++++++++++++++++++++++++----------------- 1 file changed, 29 insertions(+), 17 deletions(-) diff --git a/alethzero/Main.ui b/alethzero/Main.ui index 5c0f50a6d..3567d3ffb 100644 --- a/alethzero/Main.ui +++ b/alethzero/Main.ui @@ -161,26 +161,9 @@ Deb&ug - - - &Dump Trace - - - - - - - - - - - - - - @@ -199,10 +182,39 @@ + + + D&ebugger + + + + &Dump Trace + + + + + + + + Type Here + + + + + + + + + + + + + + From c2368432254c05a8d9afa29efd0d2f294faa8c53 Mon Sep 17 00:00:00 2001 From: Gav Wood Date: Wed, 1 Oct 2014 10:58:57 +0100 Subject: [PATCH 11/11] fix for callstateless. --- libevm/VM.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libevm/VM.h b/libevm/VM.h index cbecc3ee7..3cac55b1f 100644 --- a/libevm/VM.h +++ b/libevm/VM.h @@ -634,7 +634,7 @@ template dev::bytesConstRef dev::eth::VM::go(Ext& _ext, OnOpFunc con if (_ext.balance(_ext.myAddress) >= value) { _ext.subBalance(value); - m_stack.push_back(_ext.call(receiveAddress, value, bytesConstRef(m_temp.data() + inOff, inSize), &gas, bytesRef(m_temp.data() + outOff, outSize), _onOp, Address(), inst == Instruction::CALL ? receiveAddress : _ext.myAddress)); + m_stack.push_back(_ext.call(inst == Instruction::CALL ? receiveAddress : _ext.myAddress, value, bytesConstRef(m_temp.data() + inOff, inSize), &gas, bytesRef(m_temp.data() + outOff, outSize), _onOp, Address(), receiveAddress)); } else m_stack.push_back(0);