From 9d3a05e337a06c33a51135c4cc7041ef0b993a66 Mon Sep 17 00:00:00 2001 From: Gav Wood Date: Sun, 6 Jul 2014 13:55:53 +0200 Subject: [PATCH] Transactions filter fix. --- alethzero/Main.ui | 6 ++++++ alethzero/MainWin.cpp | 5 +++++ alethzero/MainWin.h | 1 + libethereum/Client.cpp | 2 +- libethereum/Client.h | 3 +++ 5 files changed, 16 insertions(+), 1 deletion(-) diff --git a/alethzero/Main.ui b/alethzero/Main.ui index d35e97646..68b6adae6 100644 --- a/alethzero/Main.ui +++ b/alethzero/Main.ui @@ -167,6 +167,7 @@ + @@ -1444,6 +1445,11 @@ font-size: 14pt Shift+F10 + + + &Clear Pending + + diff --git a/alethzero/MainWin.cpp b/alethzero/MainWin.cpp index 851e45aa1..da0d16b90 100644 --- a/alethzero/MainWin.cpp +++ b/alethzero/MainWin.cpp @@ -197,6 +197,11 @@ Main::~Main() writeSettings(); } +void Main::on_clearPending_triggered() +{ + m_client->clearPending(); +} + void Main::load(QString _s) { QFile fin(_s); diff --git a/alethzero/MainWin.h b/alethzero/MainWin.h index b5652d7d0..6cd1043fe 100644 --- a/alethzero/MainWin.h +++ b/alethzero/MainWin.h @@ -114,6 +114,7 @@ private slots: void on_showAllAccounts_triggered() { refresh(true); } void on_loadJS_triggered(); void on_blockChainFilter_textChanged(); + void on_clearPending_triggered(); void refresh(bool _override = false); void refreshNetwork(); diff --git a/libethereum/Client.cpp b/libethereum/Client.cpp index 7be4d2465..1c2774aa7 100644 --- a/libethereum/Client.cpp +++ b/libethereum/Client.cpp @@ -386,7 +386,7 @@ PastTransactions Client::transactions(TransactionFilter const& _f) const auto cn = m_bc.number(); auto h = m_bc.numberHash(begin); - for (unsigned n = begin; ret.size() != m; n--, h = m_bc.details(h).parent) + for (unsigned n = begin; ret.size() != m && n != end; n--, h = m_bc.details(h).parent) { try { diff --git a/libethereum/Client.h b/libethereum/Client.h index e42f7aacc..acc0afe1b 100644 --- a/libethereum/Client.h +++ b/libethereum/Client.h @@ -236,6 +236,9 @@ public: /// Get and clear the mining history. std::list miningHistory() { auto ret = m_mineHistory; m_mineHistory.clear(); return ret; } + /// Clears pending transactions. Just for debug use. + void clearPending() { ClientGuard l(this); m_postMine = m_preMine; changed(); } + private: void work();