Browse Source

More awesome logging stuff.

cl-refactor
Gav Wood 10 years ago
parent
commit
55b9038d6f
  1. 2
      alethzero/NatspecHandler.cpp
  2. 6
      eth/main.cpp
  3. 4
      libdevcore/Log.cpp
  4. 111
      libdevcore/Log.h
  5. 10
      libdevcrypto/MemoryDB.cpp
  6. 2
      libdevcrypto/OverlayDB.cpp
  7. 12
      libdevcrypto/TrieDB.h
  8. 6
      libethcore/EthashAux.cpp
  9. 28
      libethereum/BlockChain.cpp
  10. 4
      libethereum/BlockQueue.cpp
  11. 16
      libethereum/Client.cpp
  12. 2
      libevmcore/Assembly.cpp
  13. 2
      libp2p/Network.cpp
  14. 2
      libp2p/NodeTable.cpp

2
alethzero/NatspecHandler.cpp

@ -51,7 +51,7 @@ NatspecHandler::~NatspecHandler()
void NatspecHandler::add(dev::h256 const& _contractHash, string const& _doc) void NatspecHandler::add(dev::h256 const& _contractHash, string const& _doc)
{ {
m_db->Put(m_writeOptions, _contractHash.ref(), _doc); m_db->Put(m_writeOptions, _contractHash.ref(), _doc);
cdebug << "Registering NatSpec: " << _contractHash.abridged() << _doc; cdebug << "Registering NatSpec: " << _contractHash << _doc;
} }
string NatspecHandler::retrieve(dev::h256 const& _contractHash) const string NatspecHandler::retrieve(dev::h256 const& _contractHash) const

6
eth/main.cpp

@ -370,7 +370,7 @@ void doFarm(MinerType _m, string const& _remote, unsigned _recheckPeriod)
for (unsigned i = 0; !completed; ++i) for (unsigned i = 0; !completed; ++i)
{ {
if (current) if (current)
cnote << "Mining on PoWhash" << current.headerHash.abridged() << ": " << f.miningProgress(); cnote << "Mining on PoWhash" << current.headerHash << ": " << f.miningProgress();
else else
cnote << "Getting work package..."; cnote << "Getting work package...";
Json::Value v = rpc.eth_getWork(); Json::Value v = rpc.eth_getWork();
@ -380,12 +380,12 @@ void doFarm(MinerType _m, string const& _remote, unsigned _recheckPeriod)
current.headerHash = hh; current.headerHash = hh;
current.seedHash = h256(v[1].asString()); current.seedHash = h256(v[1].asString());
current.boundary = h256(fromHex(v[2].asString()), h256::AlignRight); current.boundary = h256(fromHex(v[2].asString()), h256::AlignRight);
cnote << "Got work package:" << current.headerHash.abridged() << " < " << current.boundary; cnote << "Got work package:" << current.headerHash << " < " << current.boundary;
f.setWork(current); f.setWork(current);
} }
this_thread::sleep_for(chrono::milliseconds(_recheckPeriod)); this_thread::sleep_for(chrono::milliseconds(_recheckPeriod));
} }
cnote << "Solution found; submitting [" << solution.nonce << "," << current.headerHash.abridged() << "," << solution.mixHash.abridged() << "] to" << _remote << "..."; cnote << "Solution found; submitting [" << solution.nonce << "," << current.headerHash << "," << solution.mixHash << "] to" << _remote << "...";
bool ok = rpc.eth_submitWork("0x" + toString(solution.nonce), "0x" + toString(current.headerHash), "0x" + toString(solution.mixHash)); bool ok = rpc.eth_submitWork("0x" + toString(solution.nonce), "0x" + toString(current.headerHash), "0x" + toString(solution.mixHash));
if (ok) if (ok)
clog(HappyChannel) << "Submitted and accepted."; clog(HappyChannel) << "Submitted and accepted.";

4
libdevcore/Log.cpp

@ -41,7 +41,9 @@ const char* WarnChannel::name() { return EthOnRed EthBlackBold " ✘"; }
const char* NoteChannel::name() { return EthBlue ""; } const char* NoteChannel::name() { return EthBlue ""; }
const char* DebugChannel::name() { return EthWhite ""; } const char* DebugChannel::name() { return EthWhite ""; }
LogOutputStreamBase::LogOutputStreamBase(char const* _id, std::type_info const* _info, unsigned _v) LogOutputStreamBase::LogOutputStreamBase(char const* _id, std::type_info const* _info, unsigned _v, bool _autospacing):
m_autospacing(_autospacing),
m_verbosity(_v)
{ {
auto it = g_logOverride.find(_info); auto it = g_logOverride.find(_info);
if ((it != g_logOverride.end() && it->second == true) || (it == g_logOverride.end() && (int)_v <= g_logVerbosity)) if ((it != g_logOverride.end() && it->second == true) || (it == g_logOverride.end() && (int)_v <= g_logVerbosity))

111
libdevcore/Log.h

@ -26,8 +26,12 @@
#include <ctime> #include <ctime>
#include <chrono> #include <chrono>
#include <boost/thread.hpp> #include <boost/thread.hpp>
#include <boost/asio.hpp>
#include "vector_ref.h" #include "vector_ref.h"
#include "Common.h"
#include "CommonIO.h" #include "CommonIO.h"
#include "CommonData.h"
#include "FixedHash.h"
#include "Terminal.h" #include "Terminal.h"
namespace dev namespace dev
@ -76,35 +80,128 @@ std::string getThreadName();
/// The default logging channels. Each has an associated verbosity and three-letter prefix (name() ). /// The default logging channels. Each has an associated verbosity and three-letter prefix (name() ).
/// Channels should inherit from LogChannel and define name() and verbosity. /// Channels should inherit from LogChannel and define name() and verbosity.
struct LogChannel { static const char* name(); static const int verbosity = 1; }; struct LogChannel { static const char* name(); static const int verbosity = 1; };
struct LeftChannel: public LogChannel { static const char* name(); }; struct LeftChannel: public LogChannel { static const char* name(); };
struct RightChannel: public LogChannel { static const char* name(); }; struct RightChannel: public LogChannel { static const char* name(); };
struct WarnChannel: public LogChannel { static const char* name(); static const int verbosity = 0; }; struct WarnChannel: public LogChannel { static const char* name(); static const int verbosity = 0; };
struct NoteChannel: public LogChannel { static const char* name(); }; struct NoteChannel: public LogChannel { static const char* name(); };
struct DebugChannel: public LogChannel { static const char* name(); static const int verbosity = 0; }; struct DebugChannel: public LogChannel { static const char* name(); static const int verbosity = 0; };
enum LogTag
{
None,
url,
error
};
class LogOutputStreamBase class LogOutputStreamBase
{ {
public: public:
LogOutputStreamBase(char const* _id, std::type_info const* _info, unsigned _v); LogOutputStreamBase(char const* _id, std::type_info const* _info, unsigned _v, bool _autospacing);
void comment(std::string const& _t)
{
switch (m_logTag)
{
case url: m_sstr << EthNavyUnder; break;
case error: m_sstr << EthRedBold; break;
default:;
}
m_sstr << _t << EthReset;
m_logTag = None;
}
void append(unsigned long _t) { m_sstr << EthBlue << _t << EthReset; }
void append(long _t) { m_sstr << EthBlue << _t << EthReset; }
void append(unsigned int _t) { m_sstr << EthBlue << _t << EthReset; }
void append(int _t) { m_sstr << EthBlue << _t << EthReset; }
void append(bigint const& _t) { m_sstr << EthNavy << _t << EthReset; }
void append(u256 const& _t) { m_sstr << EthNavy << _t << EthReset; }
void append(u160 const& _t) { m_sstr << EthNavy << _t << EthReset; }
void append(double _t) { m_sstr << EthBlue << _t << EthReset; }
template <unsigned N> void append(FixedHash<N> const& _t) { m_sstr << EthTeal "#" << _t.abridged() << EthReset; }
void append(h160 const& _t) { m_sstr << EthRed "@" << _t.abridged() << EthReset; }
void append(h256 const& _t) { m_sstr << EthCyan "#" << _t.abridged() << EthReset; }
void append(h512 const& _t) { m_sstr << EthTeal "##" << _t.abridged() << EthReset; }
void append(std::string const& _t) { m_sstr << EthGreen "\"" + _t + "\"" EthReset; }
void append(bytes const& _t) { m_sstr << EthYellow "%" << toHex(_t) << EthReset; }
void append(bytesConstRef _t) { m_sstr << EthYellow "%" << toHex(_t) << EthReset; }
template <class T> void append(std::vector<T> const& _t)
{
m_sstr << EthWhite "[" EthReset;
int n = 0;
for (auto const& i: _t)
{
m_sstr << (n++ ? EthWhite ", " EthReset : "");
append(i);
}
m_sstr << EthWhite "]" EthReset;
}
template <class T> void append(std::set<T> const& _t)
{
m_sstr << EthYellow "{" EthReset;
int n = 0;
for (auto const& i: _t)
{
m_sstr << (n++ ? EthYellow ", " EthReset : "");
append(i);
}
m_sstr << EthYellow "}" EthReset;
}
template <class T, class U> void append(std::map<T, U> const& _t)
{
m_sstr << EthLime "{" EthReset;
int n = 0;
for (auto const& i: _t)
{
m_sstr << (n++ ? EthLime ", " EthReset : "");
append(i.first);
m_sstr << (n++ ? EthLime ": " EthReset : "");
append(i.second);
}
m_sstr << EthLime "}" EthReset;
}
template <class T, class U> void append(std::pair<T, U> const& _t)
{
m_sstr << EthPurple "(" EthReset;
append(_t.first);
m_sstr << EthPurple ", " EthReset;
append(_t.second);
m_sstr << EthPurple ")" EthReset;
}
template <class T> void append(T const& _t)
{
m_sstr << toString(_t);
}
template <class T> void append(boost::asio::ip::tcp::endpoint const& _t)
{
m_sstr << EthNavyUnder "tcp://" << _t << EthReset;
}
protected: protected:
bool m_autospacing = false;
unsigned m_verbosity = 0;
std::stringstream m_sstr; ///< The accrued log entry. std::stringstream m_sstr; ///< The accrued log entry.
LogTag m_logTag;
}; };
/// Logging class, iostream-like, that can be shifted to. /// Logging class, iostream-like, that can be shifted to.
template <class Id, bool _AutoSpacing = true> template <class Id, bool _AutoSpacing = true>
class LogOutputStream: private LogOutputStreamBase class LogOutputStream: LogOutputStreamBase
{ {
public: public:
/// Construct a new object. /// Construct a new object.
/// If _term is true the the prefix info is terminated with a ']' character; if not it ends only with a '|' character. /// If _term is true the the prefix info is terminated with a ']' character; if not it ends only with a '|' character.
LogOutputStream(): LogOutputStreamBase(Id::name(), &typeid(Id), Id::verbosity) {} LogOutputStream(): LogOutputStreamBase(Id::name(), &typeid(Id), Id::verbosity, _AutoSpacing) {}
/// Destructor. Posts the accrued log entry to the g_logPost function. /// Destructor. Posts the accrued log entry to the g_logPost function.
~LogOutputStream() { if (Id::verbosity <= g_logVerbosity) g_logPost(m_sstr.str(), Id::name()); } ~LogOutputStream() { if (Id::verbosity <= g_logVerbosity) g_logPost(m_sstr.str(), Id::name()); }
LogOutputStream& operator<<(std::string const& _t) { if (Id::verbosity <= g_logVerbosity) { if (_AutoSpacing && m_sstr.str().size() && m_sstr.str().back() != ' ') m_sstr << " "; comment(_t); } return *this; }
LogOutputStream& operator<<(LogTag _t) { m_logTag = _t; return *this; }
/// Shift arbitrary data to the log. Spaces will be added between items as required. /// Shift arbitrary data to the log. Spaces will be added between items as required.
template <class T> LogOutputStream& operator<<(T const& _t) { if (Id::verbosity <= g_logVerbosity) { if (_AutoSpacing && m_sstr.str().size() && m_sstr.str().back() != ' ') m_sstr << " "; m_sstr << _t; } return *this; } template <class T> LogOutputStream& operator<<(T const& _t) { if (Id::verbosity <= g_logVerbosity) { if (_AutoSpacing && m_sstr.str().size() && m_sstr.str().back() != ' ') m_sstr << " "; append(_t); } return *this; }
}; };
// Simple cout-like stream objects for accessing common log channels. // Simple cout-like stream objects for accessing common log channels.

10
libdevcrypto/MemoryDB.cpp

@ -49,7 +49,7 @@ std::string MemoryDB::lookup(h256 _h) const
if (!m_enforceRefs || (m_refCount.count(it->first) && m_refCount.at(it->first))) if (!m_enforceRefs || (m_refCount.count(it->first) && m_refCount.at(it->first)))
return it->second; return it->second;
// else if (m_enforceRefs && m_refCount.count(it->first) && !m_refCount.at(it->first)) // else if (m_enforceRefs && m_refCount.count(it->first) && !m_refCount.at(it->first))
// cnote << "Lookup required for value with no refs. Let's hope it's in the DB." << _h.abridged(); // cnote << "Lookup required for value with no refs. Let's hope it's in the DB." << _h;
} }
return std::string(); return std::string();
} }
@ -67,7 +67,7 @@ void MemoryDB::insert(h256 _h, bytesConstRef _v)
m_over[_h] = _v.toString(); m_over[_h] = _v.toString();
m_refCount[_h]++; m_refCount[_h]++;
#if ETH_PARANOIA #if ETH_PARANOIA
dbdebug << "INST" << _h.abridged() << "=>" << m_refCount[_h]; dbdebug << "INST" << _h << "=>" << m_refCount[_h];
#endif #endif
} }
@ -82,15 +82,15 @@ bool MemoryDB::kill(h256 _h)
{ {
// If we get to this point, then there was probably a node in the level DB which we need to remove and which we have previously // If we get to this point, then there was probably a node in the level DB which we need to remove and which we have previously
// used as part of the memory-based MemoryDB. Nothing to be worried about *as long as the node exists in the DB*. // used as part of the memory-based MemoryDB. Nothing to be worried about *as long as the node exists in the DB*.
dbdebug << "NOKILL-WAS" << _h.abridged(); dbdebug << "NOKILL-WAS" << _h;
return false; return false;
} }
dbdebug << "KILL" << _h.abridged() << "=>" << m_refCount[_h]; dbdebug << "KILL" << _h << "=>" << m_refCount[_h];
return true; return true;
} }
else else
{ {
dbdebug << "NOKILL" << _h.abridged(); dbdebug << "NOKILL" << _h;
return false; return false;
} }
#else #else

2
libdevcrypto/OverlayDB.cpp

@ -103,7 +103,7 @@ void OverlayDB::kill(h256 _h)
if (m_db) if (m_db)
m_db->Get(m_readOptions, ldb::Slice((char const*)_h.data(), 32), &ret); m_db->Get(m_readOptions, ldb::Slice((char const*)_h.data(), 32), &ret);
if (ret.empty()) if (ret.empty())
cnote << "Decreasing DB node ref count below zero with no DB node. Probably have a corrupt Trie." << _h.abridged(); cnote << "Decreasing DB node ref count below zero with no DB node. Probably have a corrupt Trie." << _h;
} }
#else #else
MemoryDB::kill(_h); MemoryDB::kill(_h);

12
libdevcrypto/TrieDB.h

@ -120,14 +120,14 @@ public:
if (_r.isList() && _r.itemCount() == 2 && (!_wasExt || _out)) if (_r.isList() && _r.itemCount() == 2 && (!_wasExt || _out))
{ {
if (_out) if (_out)
(*_out) << std::string(_indent * 2, ' ') << (_wasExt ? "!2 " : "2 ") << sha3(_r.data()).abridged() << ": " << _r << "\n"; (*_out) << std::string(_indent * 2, ' ') << (_wasExt ? "!2 " : "2 ") << sha3(_r.data()) << ": " << _r << "\n";
if (!isLeaf(_r)) // don't go down leaves if (!isLeaf(_r)) // don't go down leaves
descendEntry(_r[1], _keyMask, true, _out, _indent + 1); descendEntry(_r[1], _keyMask, true, _out, _indent + 1);
} }
else if (_r.isList() && _r.itemCount() == 17) else if (_r.isList() && _r.itemCount() == 17)
{ {
if (_out) if (_out)
(*_out) << std::string(_indent * 2, ' ') << "17 " << sha3(_r.data()).abridged() << ": " << _r << "\n"; (*_out) << std::string(_indent * 2, ' ') << "17 " << sha3(_r.data()) << ": " << _r << "\n";
for (unsigned i = 0; i < 16; ++i) for (unsigned i = 0; i < 16; ++i)
if (!_r[i].isEmpty()) // 16 branches are allowed to be empty if (!_r[i].isEmpty()) // 16 branches are allowed to be empty
descendEntry(_r[i], _keyMask, false, _out, _indent + 1); descendEntry(_r[i], _keyMask, false, _out, _indent + 1);
@ -779,7 +779,7 @@ template <class DB> std::string GenericTrieDB<DB>::atAux(RLP const& _here, Nibbl
template <class DB> bytes GenericTrieDB<DB>::mergeAt(RLP const& _orig, NibbleSlice _k, bytesConstRef _v, bool _inLine) template <class DB> bytes GenericTrieDB<DB>::mergeAt(RLP const& _orig, NibbleSlice _k, bytesConstRef _v, bool _inLine)
{ {
#if ETH_PARANOIA #if ETH_PARANOIA
tdebug << "mergeAt " << _orig << _k << sha3(_orig.data()).abridged(); tdebug << "mergeAt " << _orig << _k << sha3(_orig.data());
#endif #endif
// The caller will make sure that the bytes are inserted properly. // The caller will make sure that the bytes are inserted properly.
@ -854,7 +854,7 @@ template <class DB> bytes GenericTrieDB<DB>::mergeAt(RLP const& _orig, NibbleSli
template <class DB> void GenericTrieDB<DB>::mergeAtAux(RLPStream& _out, RLP const& _orig, NibbleSlice _k, bytesConstRef _v) template <class DB> void GenericTrieDB<DB>::mergeAtAux(RLPStream& _out, RLP const& _orig, NibbleSlice _k, bytesConstRef _v)
{ {
#if ETH_PARANOIA #if ETH_PARANOIA
tdebug << "mergeAtAux " << _orig << _k << sha3(_orig.data()).abridged() << ((_orig.isData() && _orig.size() <= 32) ? _orig.toHash<h256>().abridged() : std::string()); tdebug << "mergeAtAux " << _orig << _k << sha3(_orig.data()) << ((_orig.isData() && _orig.size() <= 32) ? _orig.toHash<h256>() : std::string());
#endif #endif
RLP r = _orig; RLP r = _orig;
@ -902,7 +902,7 @@ template <class DB> std::string GenericTrieDB<DB>::deref(RLP const& _n) const
template <class DB> bytes GenericTrieDB<DB>::deleteAt(RLP const& _orig, NibbleSlice _k) template <class DB> bytes GenericTrieDB<DB>::deleteAt(RLP const& _orig, NibbleSlice _k)
{ {
#if ETH_PARANOIA #if ETH_PARANOIA
tdebug << "deleteAt " << _orig << _k << sha3(_orig.data()).abridged(); tdebug << "deleteAt " << _orig << _k << sha3(_orig.data());
#endif #endif
// The caller will make sure that the bytes are inserted properly. // The caller will make sure that the bytes are inserted properly.
@ -1009,7 +1009,7 @@ template <class DB> bytes GenericTrieDB<DB>::deleteAt(RLP const& _orig, NibbleSl
template <class DB> bool GenericTrieDB<DB>::deleteAtAux(RLPStream& _out, RLP const& _orig, NibbleSlice _k) template <class DB> bool GenericTrieDB<DB>::deleteAtAux(RLPStream& _out, RLP const& _orig, NibbleSlice _k)
{ {
#if ETH_PARANOIA #if ETH_PARANOIA
tdebug << "deleteAtAux " << _orig << _k << sha3(_orig.data()).abridged() << ((_orig.isData() && _orig.size() <= 32) ? _orig.toHash<h256>().abridged() : std::string()); tdebug << "deleteAtAux " << _orig << _k << sha3(_orig.data()) << ((_orig.isData() && _orig.size() <= 32) ? _orig.toHash<h256>() : std::string());
#endif #endif
bytes b = _orig.isEmpty() ? bytes() : deleteAt(_orig.isList() ? _orig : RLP(node(_orig.toHash<h256>())), _k); bytes b = _orig.isEmpty() ? bytes() : deleteAt(_orig.isList() ? _orig : RLP(node(_orig.toHash<h256>())), _k);

6
libethcore/EthashAux.cpp

@ -79,7 +79,7 @@ h256 EthashAux::seedHash(unsigned _number)
for (; n <= epoch; ++n, ret = sha3(ret)) for (; n <= epoch; ++n, ret = sha3(ret))
{ {
get()->m_seedHashes[n] = ret; get()->m_seedHashes[n] = ret;
// cdebug << "Epoch" << n << "is" << ret.abridged(); // cdebug << "Epoch" << n << "is" << ret;
} }
} }
return get()->m_seedHashes[epoch]; return get()->m_seedHashes[epoch];
@ -95,12 +95,12 @@ ethash_params EthashAux::params(h256 const& _seedHash)
} }
catch (...) catch (...)
{ {
// cdebug << "Searching for seedHash " << _seedHash.abridged(); // cdebug << "Searching for seedHash " << _seedHash;
for (h256 h; h != _seedHash && epoch < 2048; ++epoch, h = sha3(h), get()->m_epochs[h] = epoch) {} for (h256 h; h != _seedHash && epoch < 2048; ++epoch, h = sha3(h), get()->m_epochs[h] = epoch) {}
if (epoch == 2048) if (epoch == 2048)
{ {
std::ostringstream error; std::ostringstream error;
error << "apparent block number for " << _seedHash.abridged() << " is too high; max is " << (ETHASH_EPOCH_LENGTH * 2048); error << "apparent block number for " << _seedHash << " is too high; max is " << (ETHASH_EPOCH_LENGTH * 2048);
throw std::invalid_argument(error.str()); throw std::invalid_argument(error.str());
} }
} }

28
libethereum/BlockChain.cpp

@ -247,7 +247,7 @@ void BlockChain::rebuild(std::string const& _path, std::function<void(unsigned,
if (bi.parentHash != lastHash) if (bi.parentHash != lastHash)
{ {
cwarn << "DISJOINT CHAIN DETECTED; " << bi.hash().abridged() << "#" << d << " -> parent is" << bi.parentHash.abridged() << "; expected" << lastHash.abridged() << "#" << (d - 1); cwarn << "DISJOINT CHAIN DETECTED; " << bi.hash() << "#" << d << " -> parent is" << bi.parentHash << "; expected" << lastHash << "#" << (d - 1);
return; return;
} }
lastHash = bi.hash(); lastHash = bi.hash();
@ -280,16 +280,6 @@ bool contains(T const& _t, V const& _v)
return false; return false;
} }
inline string toString(h256s const& _bs)
{
ostringstream out;
out << "[ ";
for (auto i: _bs)
out << i.abridged() << ", ";
out << "]";
return out.str();
}
LastHashes BlockChain::lastHashes(unsigned _n) const LastHashes BlockChain::lastHashes(unsigned _n) const
{ {
Guard l(x_lastLastHashes); Guard l(x_lastLastHashes);
@ -323,14 +313,14 @@ tuple<h256s, h256s, bool> BlockChain::sync(BlockQueue& _bq, OverlayDB const& _st
} }
catch (dev::eth::UnknownParent) catch (dev::eth::UnknownParent)
{ {
cwarn << "ODD: Import queue contains block with unknown parent." << boost::current_exception_diagnostic_information(); cwarn << "ODD: Import queue contains block with unknown parent." << error << boost::current_exception_diagnostic_information();
// NOTE: don't reimport since the queue should guarantee everything in the right order. // NOTE: don't reimport since the queue should guarantee everything in the right order.
// Can't continue - chain bad. // Can't continue - chain bad.
badBlocks.push_back(BlockInfo::headerHash(block)); badBlocks.push_back(BlockInfo::headerHash(block));
} }
catch (Exception const& _e) catch (Exception const& _e)
{ {
cnote << "Exception while importing block. Someone (Jeff? That you?) seems to be giving us dodgy blocks!" << diagnostic_information(_e); cnote << "Exception while importing block. Someone (Jeff? That you?) seems to be giving us dodgy blocks!" << error << diagnostic_information(_e);
// NOTE: don't reimport since the queue should guarantee everything in the right order. // NOTE: don't reimport since the queue should guarantee everything in the right order.
// Can't continue - chain bad. // Can't continue - chain bad.
badBlocks.push_back(BlockInfo::headerHash(block)); badBlocks.push_back(BlockInfo::headerHash(block));
@ -427,7 +417,7 @@ ImportRoute BlockChain::import(bytes const& _block, OverlayDB const& _db, Import
BOOST_THROW_EXCEPTION(FutureTime()); BOOST_THROW_EXCEPTION(FutureTime());
} }
clog(BlockChainChat) << "Attempting import of " << bi.hash().abridged() << "..."; clog(BlockChainChat) << "Attempting import of " << bi.hash() << "...";
#if ETH_TIMED_IMPORTS #if ETH_TIMED_IMPORTS
preliminaryChecks = t.elapsed(); preliminaryChecks = t.elapsed();
@ -704,7 +694,7 @@ void BlockChain::clearBlockBlooms(unsigned _begin, unsigned _end)
tuple<h256s, h256, unsigned> BlockChain::treeRoute(h256 const& _from, h256 const& _to, bool _common, bool _pre, bool _post) const tuple<h256s, h256, unsigned> BlockChain::treeRoute(h256 const& _from, h256 const& _to, bool _common, bool _pre, bool _post) const
{ {
// cdebug << "treeRoute" << _from.abridged() << "..." << _to.abridged(); // cdebug << "treeRoute" << _from << "..." << _to;
if (!_from || !_to) if (!_from || !_to)
return make_tuple(h256s(), h256(), 0); return make_tuple(h256s(), h256(), 0);
h256s ret; h256s ret;
@ -719,7 +709,7 @@ tuple<h256s, h256, unsigned> BlockChain::treeRoute(h256 const& _from, h256 const
ret.push_back(from); ret.push_back(from);
from = details(from).parent; from = details(from).parent;
fn--; fn--;
// cdebug << "from:" << fn << _from.abridged(); // cdebug << "from:" << fn << _from;
} }
h256 to = _to; h256 to = _to;
while (fn < tn) while (fn < tn)
@ -728,7 +718,7 @@ tuple<h256s, h256, unsigned> BlockChain::treeRoute(h256 const& _from, h256 const
back.push_back(to); back.push_back(to);
to = details(to).parent; to = details(to).parent;
tn--; tn--;
// cdebug << "to:" << tn << _to.abridged(); // cdebug << "to:" << tn << _to;
} }
for (;; from = details(from).parent, to = details(to).parent) for (;; from = details(from).parent, to = details(to).parent)
{ {
@ -738,7 +728,7 @@ tuple<h256s, h256, unsigned> BlockChain::treeRoute(h256 const& _from, h256 const
back.push_back(to); back.push_back(to);
fn--; fn--;
tn--; tn--;
// cdebug << "from:" << fn << _from.abridged() << "; to:" << tn << _to.abridged(); // cdebug << "from:" << fn << _from << "; to:" << tn << _to;
if (from == to) if (from == to)
break; break;
if (!from) if (!from)
@ -1010,7 +1000,7 @@ bytes BlockChain::block(h256 const& _hash) const
if (d.empty()) if (d.empty())
{ {
cwarn << "Couldn't find requested block:" << _hash.abridged(); cwarn << "Couldn't find requested block:" << _hash;
return bytes(); return bytes();
} }

4
libethereum/BlockQueue.cpp

@ -36,7 +36,7 @@ ImportResult BlockQueue::import(bytesConstRef _block, BlockChain const& _bc, boo
// Check if we already know this block. // Check if we already know this block.
h256 h = BlockInfo::headerHash(_block); h256 h = BlockInfo::headerHash(_block);
cblockq << "Queuing block" << h.abridged() << "for import..."; cblockq << "Queuing block" << h << "for import...";
UpgradableGuard l(m_lock); UpgradableGuard l(m_lock);
@ -95,7 +95,7 @@ ImportResult BlockQueue::import(bytesConstRef _block, BlockChain const& _bc, boo
else if (!m_readySet.count(bi.parentHash) && !m_drainingSet.count(bi.parentHash) && !_bc.isKnown(bi.parentHash)) else if (!m_readySet.count(bi.parentHash) && !m_drainingSet.count(bi.parentHash) && !_bc.isKnown(bi.parentHash))
{ {
// We don't know the parent (yet) - queue it up for later. It'll get resent to us if we find out about its ancestry later on. // We don't know the parent (yet) - queue it up for later. It'll get resent to us if we find out about its ancestry later on.
cblockq << "OK - queued as unknown parent:" << bi.parentHash.abridged(); cblockq << "OK - queued as unknown parent:" << bi.parentHash;
m_unknown.insert(make_pair(bi.parentHash, make_pair(h, _block.toBytes()))); m_unknown.insert(make_pair(bi.parentHash, make_pair(h, _block.toBytes())));
m_unknownSet.insert(h); m_unknownSet.insert(h);

16
libethereum/Client.cpp

@ -291,7 +291,15 @@ static string filtersToString(T const& _fs)
ret << "{"; ret << "{";
unsigned i = 0; unsigned i = 0;
for (h256 const& f: _fs) for (h256 const& f: _fs)
ret << (i++ ? ", " : "") << (f == PendingChangedFilter ? "pending" : f == ChainChangedFilter ? "chain" : f.abridged()); {
ret << (i++ ? ", " : "");
if (f == PendingChangedFilter)
ret << url << "pending";
else if (f == ChainChangedFilter)
ret << url << "chain";
else
ret << f;
}
ret << "}"; ret << "}";
return ret.str(); return ret.str();
} }
@ -475,7 +483,7 @@ void Client::onChainChanged(ImportRoute const& _ir)
// insert transactions that we are declaring the dead part of the chain // insert transactions that we are declaring the dead part of the chain
for (auto const& h: _ir.second) for (auto const& h: _ir.second)
{ {
clog(ClientNote) << "Dead block:" << h.abridged(); clog(ClientNote) << "Dead block:" << h;
for (auto const& t: m_bc.transactions(h)) for (auto const& t: m_bc.transactions(h))
{ {
clog(ClientNote) << "Resubmitting transaction " << Transaction(t, CheckTransaction::None); clog(ClientNote) << "Resubmitting transaction " << Transaction(t, CheckTransaction::None);
@ -486,10 +494,10 @@ void Client::onChainChanged(ImportRoute const& _ir)
// remove transactions from m_tq nicely rather than relying on out of date nonce later on. // remove transactions from m_tq nicely rather than relying on out of date nonce later on.
for (auto const& h: _ir.first) for (auto const& h: _ir.first)
{ {
clog(ClientChat) << "Live block:" << h.abridged(); clog(ClientChat) << "Live block:" << h;
for (auto const& th: m_bc.transactionHashes(h)) for (auto const& th: m_bc.transactionHashes(h))
{ {
clog(ClientNote) << "Safely dropping transaction " << th.abridged(); clog(ClientNote) << "Safely dropping transaction " << th;
m_tq.drop(th); m_tq.drop(th);
} }
} }

2
libevmcore/Assembly.cpp

@ -311,7 +311,7 @@ Assembly& Assembly::optimise(bool _enable)
unsigned total = 0; unsigned total = 0;
for (unsigned count = 1; count > 0; total += count) for (unsigned count = 1; count > 0; total += count)
{ {
copt << *this; copt << toString(*this);
count = 0; count = 0;
copt << "Performing control flow analysis..."; copt << "Performing control flow analysis...";

2
libp2p/Network.cpp

@ -228,7 +228,7 @@ bi::tcp::endpoint Network::resolveHost(string const& _addr)
bi::tcp::resolver r(s_resolverIoService); bi::tcp::resolver r(s_resolverIoService);
auto it = r.resolve({split[0], toString(port)}, ec); auto it = r.resolve({split[0], toString(port)}, ec);
if (ec) if (ec)
clog(NetWarn) << "Error resolving host address " << _addr << ":" << ec.message(); clog(NetWarn) << "Error resolving host address..." << url << _addr << ":" << error << ec.message();
else else
ep = *it; ep = *it;
} }

2
libp2p/NodeTable.cpp

@ -87,7 +87,7 @@ shared_ptr<NodeEntry> NodeTable::addNode(Node const& _node)
// we handle when tcp endpoint is 0 below // we handle when tcp endpoint is 0 below
if (_node.endpoint.address.to_string() == "0.0.0.0") if (_node.endpoint.address.to_string() == "0.0.0.0")
{ {
clog(NodeTableWarn) << "addNode Failed. Invalid UDP address 0.0.0.0 for" << _node.id.abridged(); clog(NodeTableWarn) << "addNode Failed. Invalid UDP address" << url << "0.0.0.0" << "for" << _node.id;
return move(shared_ptr<NodeEntry>()); return move(shared_ptr<NodeEntry>());
} }

Loading…
Cancel
Save