From 494bf5ee486496e69584d027db6ef6ed9ae265fb Mon Sep 17 00:00:00 2001 From: Gav Wood Date: Fri, 9 Jan 2015 10:45:14 +0100 Subject: [PATCH] Clear pending and some other AlethZero stuff. --- alethzero/Main.ui | 6 ++++++ alethzero/MainWin.cpp | 35 ++++++++++++++++++++++++++--------- alethzero/MainWin.h | 1 + libethereum/Client.cpp | 2 +- 4 files changed, 34 insertions(+), 10 deletions(-) diff --git a/alethzero/Main.ui b/alethzero/Main.ui index 1fdf7de19..e5e5a9f56 100644 --- a/alethzero/Main.ui +++ b/alethzero/Main.ui @@ -165,6 +165,7 @@ + @@ -2049,6 +2050,11 @@ font-size: 14pt New Identity + + + Clear Pe&nd&ing + + diff --git a/alethzero/MainWin.cpp b/alethzero/MainWin.cpp index 8b7acf26e..a44af8a2d 100644 --- a/alethzero/MainWin.cpp +++ b/alethzero/MainWin.cpp @@ -1236,6 +1236,7 @@ void Main::on_transactionQueue_currentItemChanged() if (i >= 0 && i < (int)ethereum()->pending().size()) { Transaction tx(ethereum()->pending()[i]); + TransactionReceipt receipt(ethereum()->postState().receipt(i)); auto ss = tx.safeSender(); h256 th = sha3(rlpList(ss, tx.nonce())); s << "

" << th << "

"; @@ -1258,12 +1259,15 @@ void Main::on_transactionQueue_currentItemChanged() if (tx.data().size()) s << dev::memDump(tx.data(), 16, true); } + s << "
Hex: " << toHex(tx.rlp()) << "
"; s << "
"; - + s << "
Log Bloom: " << receipt.bloom() << "
"; + auto r = receipt.rlp(); + s << "
Receipt: " << toString(RLP(r)) << "
"; + s << "
Receipt-Hex: " << toHex(receipt.rlp()) << "
"; + s << renderDiff(ethereum()->diff(i, -1)); // s << "Pre: " << fs.rootHash() << "
"; // s << "Post: " << ts.rootHash() << ""; - - s << renderDiff(ethereum()->diff(i, 0)); } ui->pendingInfo->setHtml(QString::fromStdString(s.str())); @@ -1376,11 +1380,6 @@ void Main::on_blocks_currentItemChanged() s << "
R: " << hex << nouppercase << tx.signature().r << ""; s << "
S: " << hex << nouppercase << tx.signature().s << ""; s << "
Msg: " << tx.sha3(eth::WithoutSignature) << ""; - s << "
Log Bloom: " << receipt.bloom() << "
"; - s << "
Hex: " << toHex(block[1][txi].data()) << "
"; - auto r = receipt.rlp(); - s << "
Receipt: " << toString(RLP(r)) << "
"; - s << "
Receipt-Hex: " << toHex(receipt.rlp()) << "
"; if (tx.isCreation()) { if (tx.data().size()) @@ -1391,6 +1390,12 @@ void Main::on_blocks_currentItemChanged() if (tx.data().size()) s << dev::memDump(tx.data(), 16, true); } + s << "
Hex: " << toHex(block[1][txi].data()) << "
"; + s << "
"; + s << "
Log Bloom: " << receipt.bloom() << "
"; + auto r = receipt.rlp(); + s << "
Receipt: " << toString(RLP(r)) << "
"; + s << "
Receipt-Hex: " << toHex(receipt.rlp()) << "
"; s << renderDiff(ethereum()->diff(txi, h)); ui->debugCurrent->setEnabled(true); ui->debugDumpState->setEnabled(true); @@ -1631,7 +1636,7 @@ void Main::on_data_textChanged() { m_data = fromHex(src); } - else if (src.substr(0, 8) == "contract" || src.substr(0, 2) == "/*") // improve this heuristic + else if (src.substr(0, 8) == "contract" || src.substr(0, 5) == "//sol") // improve this heuristic { dev::solidity::CompilerStack compiler; try @@ -1714,6 +1719,18 @@ void Main::on_data_textChanged() updateFee(); } +void Main::on_clearPending_triggered() +{ + writeSettings(); + ui->mine->setChecked(false); + ui->net->setChecked(false); + web3()->stopNetwork(); + ethereum()->clearPending(); + readSettings(true); + installWatches(); + refreshAll(); +} + void Main::on_killBlockchain_triggered() { writeSettings(); diff --git a/alethzero/MainWin.h b/alethzero/MainWin.h index 55d4c2173..bb79e59ef 100644 --- a/alethzero/MainWin.h +++ b/alethzero/MainWin.h @@ -128,6 +128,7 @@ private slots: void on_debugTimeline_valueChanged(); void on_jsInput_returnPressed(); void on_killBlockchain_triggered(); + void on_clearPending_triggered(); void on_importKey_triggered(); void on_exportKey_triggered(); void on_inject_triggered(); diff --git a/libethereum/Client.cpp b/libethereum/Client.cpp index d8967c084..a57faf546 100644 --- a/libethereum/Client.cpp +++ b/libethereum/Client.cpp @@ -534,7 +534,7 @@ eth::State Client::state(unsigned _txi) const StateDiff Client::diff(unsigned _txi, int _block) const { - State st = state(_block); + State st = asOf(_block); return st.fromPending(_txi).diff(st.fromPending(_txi + 1)); }