Browse Source

Logging & diagnostics.

cl-refactor
Gav Wood 10 years ago
parent
commit
97671963fc
  1. 3
      libethereum/Client.cpp
  2. 23
      libethereum/Client.h
  3. 1
      mix/CodeEditorExtensionManager.cpp
  4. 3
      mix/MixClient.cpp
  5. 9
      mix/Web3Server.cpp
  6. 1
      mix/Web3Server.h

3
libethereum/Client.cpp

@ -226,11 +226,12 @@ void Client::uninstallWatch(unsigned _i)
void Client::noteChanged(h256Set const& _filters)
{
Guard l(m_filterLock);
cnote << "noteChanged(" << _filters << ")";
// accrue all changes left in each filter into the watches.
for (auto& i: m_watches)
if (_filters.count(i.second.id))
{
// cwatch << "!!!" << i.first << i.second.id;
cwatch << "!!!" << i.first << i.second.id;
if (m_filters.count(i.second.id))
i.second.changes += m_filters.at(i.second.id).changes;
else

23
libethereum/Client.h

@ -277,17 +277,7 @@ public:
/// Kills the blockchain. Just for debug use.
void killChain();
private:
/// Do some work. Handles blockchain maintenance and mining.
virtual void doWork();
virtual void doneWorking();
/// Overrides for being a mining host.
virtual void setupState(State& _s);
virtual bool turbo() const { return m_turboMining; }
virtual bool force() const { return m_forceMining; }
protected:
/// Collate the changed filters for the bloom filter of the given pending transaction.
/// Insert any filters that are activated into @a o_changed.
void appendFromNewPending(TransactionReceipt const& _receipt, h256Set& io_changed);
@ -300,6 +290,17 @@ private:
/// This doesn't actually make any callbacks, but incrememnts some counters in m_watches.
void noteChanged(h256Set const& _filters);
private:
/// Do some work. Handles blockchain maintenance and mining.
virtual void doWork();
virtual void doneWorking();
/// Overrides for being a mining host.
virtual void setupState(State& _s);
virtual bool turbo() const { return m_turboMining; }
virtual bool force() const { return m_forceMining; }
/// Return the actual block number of the block with the given int-number (positive is the same, INT_MIN is genesis block, < 0 is negative age, thus -1 is most recently mined, 0 is pending.
unsigned numberOf(int _b) const;

1
mix/CodeEditorExtensionManager.cpp

@ -51,7 +51,6 @@ void CodeEditorExtensionManager::loadEditor(QQuickItem* _editor)
{
if (!_editor)
return;
}
void CodeEditorExtensionManager::initExtensions()

3
mix/MixClient.cpp

@ -133,7 +133,6 @@ void MixClient::executeTransaction(Transaction const& _t, State& _state)
h256Set changed;
Guard l(m_filterLock);
for (std::pair<h256 const, eth::InstalledFilter>& i: m_filters)
{
if ((unsigned)i.second.filter.latest() > m_blocks.size() - 1)
{
// acceptable number.
@ -146,7 +145,6 @@ void MixClient::executeTransaction(Transaction const& _t, State& _state)
changed.insert(i.first);
}
}
}
changed.insert(dev::eth::PendingChangedFilter);
noteChanged(changed);
}
@ -181,7 +179,6 @@ State const& MixClient::asOf(int _block) const
return m_blocks[_block].state;
}
void MixClient::transact(Secret _secret, u256 _value, Address _dest, bytes const& _data, u256 _gas, u256 _gasPrice)
{
WriteGuard l(x_state);

9
mix/Web3Server.cpp

@ -20,8 +20,9 @@
* Ethereum IDE client.
*/
#include <libdevcore/Exceptions.h>
#include <libdevcore/Log.h>
#include <libethereum/Interface.h>
#include "Web3Server.h"
using namespace dev::mix;
@ -54,6 +55,12 @@ void Web3Server::put(std::string const& _name, std::string const& _key, std::str
m_db[k] = _value;
}
Json::Value Web3Server::eth_changed(int const& _id)
{
cnote << "eth_changed(" << _id << ") ->" << client()->peekWatch(_id).size();
return WebThreeStubServerBase::eth_changed(_id);
}
std::string Web3Server::eth_transact(Json::Value const& _json)
{

1
mix/Web3Server.h

@ -44,6 +44,7 @@ signals:
void newTransaction();
protected:
virtual Json::Value eth_changed(int const& _id) override;
virtual std::string eth_transact(Json::Value const& _json) override;
virtual std::string eth_call(Json::Value const& _json) override;

Loading…
Cancel
Save