diff --git a/alethzero/NatspecHandler.cpp b/alethzero/NatspecHandler.cpp index ffab6db58..a7cad6853 100644 --- a/alethzero/NatspecHandler.cpp +++ b/alethzero/NatspecHandler.cpp @@ -58,7 +58,7 @@ string NatspecHandler::retrieve(dev::h256 const& _contractHash) const { string ret; m_db->Get(m_readOptions, _contractHash.ref(), &ret); - cdebug << "Looking up NatSpec: " << _contractHash.abridged() << ret; + cdebug << "Looking up NatSpec: " << _contractHash << ret; return ret; } diff --git a/eth/main.cpp b/eth/main.cpp index 2d79f4954..9cc1b6e22 100644 --- a/eth/main.cpp +++ b/eth/main.cpp @@ -517,7 +517,7 @@ int main(int argc, char** argv) bool bootstrap = false; /// Mining params - unsigned mining = ~(unsigned)0; + unsigned mining = 0; bool forceMining = false; KeyPair sigKey = KeyPair::create(); Secret sessionSecret; diff --git a/libdevcore/Log.h b/libdevcore/Log.h index 71c2b3450..f63bf26c2 100644 --- a/libdevcore/Log.h +++ b/libdevcore/Log.h @@ -86,11 +86,12 @@ struct WarnChannel: public LogChannel { static const char* name(); static const struct NoteChannel: public LogChannel { static const char* name(); }; struct DebugChannel: public LogChannel { static const char* name(); static const int verbosity = 0; }; -enum LogTag +enum class LogTag { None, - url, - error + Url, + Error, + Special }; class LogOutputStreamBase @@ -102,12 +103,13 @@ public: { switch (m_logTag) { - case url: m_sstr << EthNavyUnder; break; - case error: m_sstr << EthRedBold; break; + case LogTag::Url: m_sstr << EthNavyUnder; break; + case LogTag::Error: m_sstr << EthRedBold; break; + case LogTag::Special: m_sstr << EthWhiteBold; break; default:; } m_sstr << _t << EthReset; - m_logTag = None; + m_logTag = LogTag::None; } void append(unsigned long _t) { m_sstr << EthBlue << _t << EthReset; } diff --git a/libdevcore/Worker.cpp b/libdevcore/Worker.cpp index 7fe320420..a68c18958 100644 --- a/libdevcore/Worker.cpp +++ b/libdevcore/Worker.cpp @@ -29,18 +29,25 @@ using namespace dev; void Worker::startWorking() { -// cnote << "startWorking for thread" << m_name; + cnote << "startWorking for thread" << m_name; Guard l(x_work); - m_state = WorkerState::Starting; - if (!m_work) + if (m_work) { + WorkerState ex = WorkerState::Stopped; + m_state.compare_exchange_strong(ex, WorkerState::Starting); + } + else + { + m_state = WorkerState::Starting; m_work.reset(new thread([&]() { setThreadName(m_name.c_str()); + cnote << "Thread begins"; while (m_state != WorkerState::Killing) { WorkerState ex = WorkerState::Starting; - m_state.compare_exchange_strong(ex, WorkerState::Started); + bool ok = m_state.compare_exchange_strong(ex, WorkerState::Started); + cnote << "Trying to set Started: Thread was" << (unsigned)ex << "; " << ok; startedWorking(); cnote << "Entering work loop..."; @@ -52,22 +59,25 @@ void Worker::startWorking() // m_state.compare_exchange_strong(ex, WorkerState::Stopped); ex = m_state.exchange(WorkerState::Stopped); - if (ex == WorkerState::Killing) + cnote << "State: Stopped: Thread was" << (unsigned)ex; + if (ex == WorkerState::Killing || ex == WorkerState::Starting) m_state.exchange(ex); + cnote << "Waiting until not Stopped..."; while (m_state == WorkerState::Stopped) this_thread::sleep_for(chrono::milliseconds(20)); } })); cnote << "Spawning" << m_name; } + cnote << "Waiting until Started..."; while (m_state != WorkerState::Started) this_thread::sleep_for(chrono::microseconds(20)); } void Worker::stopWorking() { -// cnote << "stopWorking for thread" << m_name; + cnote << "stopWorking for thread" << m_name; ETH_GUARDED(x_work) if (m_work) { @@ -75,6 +85,7 @@ void Worker::stopWorking() WorkerState ex = WorkerState::Started; m_state.compare_exchange_strong(ex, WorkerState::Stopping); + cnote << "Waiting until Stopped..."; while (m_state != WorkerState::Stopped) this_thread::sleep_for(chrono::microseconds(20)); } diff --git a/libethereum/BlockChain.cpp b/libethereum/BlockChain.cpp index fbc92a863..f9c21752d 100644 --- a/libethereum/BlockChain.cpp +++ b/libethereum/BlockChain.cpp @@ -320,14 +320,14 @@ tuple BlockChain::sync(BlockQueue& _bq, OverlayDB const& _st } catch (dev::eth::UnknownParent) { - cwarn << "ODD: Import queue contains block with unknown parent." << error << boost::current_exception_diagnostic_information(); + cwarn << "ODD: Import queue contains block with unknown parent." << LogTag::Error << boost::current_exception_diagnostic_information(); // NOTE: don't reimport since the queue should guarantee everything in the right order. // Can't continue - chain bad. badBlocks.push_back(BlockInfo::headerHash(block)); } catch (Exception const& _e) { - cnote << "Exception while importing block. Someone (Jeff? That you?) seems to be giving us dodgy blocks!" << error << diagnostic_information(_e); + cnote << "Exception while importing block. Someone (Jeff? That you?) seems to be giving us dodgy blocks!" << LogTag::Error << diagnostic_information(_e); // NOTE: don't reimport since the queue should guarantee everything in the right order. // Can't continue - chain bad. badBlocks.push_back(BlockInfo::headerHash(block)); @@ -611,7 +611,7 @@ ImportRoute BlockChain::import(bytes const& _block, OverlayDB const& _db, Import m_extrasDB->Put(m_writeOptions, ldb::Slice("best"), ldb::Slice((char const*)&(bi.hash()), 32)); } - clog(BlockChainNote) << " Imported and best" << td << " (#" << bi.number << "). Has" << (details(bi.parentHash).children.size() - 1) << "siblings. Route:" << toString(route); + clog(BlockChainNote) << " Imported and best" << td << " (#" << bi.number << "). Has" << (details(bi.parentHash).children.size() - 1) << "siblings. Route:" << route; noteCanonChanged(); StructuredLogger::chainNewHead( diff --git a/libethereum/Client.cpp b/libethereum/Client.cpp index 408f8ebca..675999a13 100644 --- a/libethereum/Client.cpp +++ b/libethereum/Client.cpp @@ -291,24 +291,23 @@ void Client::clearPending() noteChanged(changeds); } -template -static string filtersToString(T const& _fs) +template +static S& filtersStreamOut(S& _out, T const& _fs) { - stringstream ret; - ret << "{"; + _out << "{"; unsigned i = 0; for (h256 const& f: _fs) { - ret << (i++ ? ", " : ""); + _out << (i++ ? ", " : ""); if (f == PendingChangedFilter) - ret << url << "pending"; + _out << LogTag::Special << "pending"; else if (f == ChainChangedFilter) - ret << url << "chain"; + _out << LogTag::Special << "chain"; else - ret << f; + _out << f; } - ret << "}"; - return ret.str(); + _out << "}"; + return _out; } void Client::appendFromNewPending(TransactionReceipt const& _receipt, h256Set& io_changed, h256 _transactionHash) @@ -572,16 +571,21 @@ void Client::noteChanged(h256Set const& _filters) { Guard l(x_filtersWatches); if (_filters.size()) - cnote << "noteChanged(" << filtersToString(_filters) << ")"; + filtersStreamOut(cnote << "noteChanged:", _filters); // accrue all changes left in each filter into the watches. for (auto& w: m_watches) if (_filters.count(w.second.id)) { - cwatch << "!!!" << w.first << (m_filters.count(w.second.id) ? w.second.id.abridged() : w.second.id == PendingChangedFilter ? "pending" : w.second.id == ChainChangedFilter ? "chain" : "???"); - if (m_filters.count(w.second.id)) // Normal filtering watch + if (m_filters.count(w.second.id)) + { + cwatch << "!!!" << w.first << w.second.id.abridged(); w.second.changes += m_filters.at(w.second.id).changes; - else // Special ('pending'/'latest') watch + } + else + { + cwatch << "!!!" << w.first << LogTag::Special << (w.second.id == PendingChangedFilter ? "pending" : w.second.id == ChainChangedFilter ? "chain" : "???"); w.second.changes.push_back(LocalisedLogEntry(SpecialLogEntry, 0)); + } } // clear the filters now. for (auto& i: m_filters) diff --git a/libethereum/ClientBase.cpp b/libethereum/ClientBase.cpp index 6092879b9..ac1b09ab0 100644 --- a/libethereum/ClientBase.cpp +++ b/libethereum/ClientBase.cpp @@ -226,7 +226,7 @@ unsigned ClientBase::installWatch(LogFilter const& _f, Reaping _r) Guard l(x_filtersWatches); if (!m_filters.count(h)) { - cwatch << "FFF" << _f << h.abridged(); + cwatch << "FFF" << _f << h; m_filters.insert(make_pair(h, _f)); } } @@ -240,7 +240,7 @@ unsigned ClientBase::installWatch(h256 _h, Reaping _r) Guard l(x_filtersWatches); ret = m_watches.size() ? m_watches.rbegin()->first + 1 : 0; m_watches[ret] = ClientWatch(_h, _r); - cwatch << "+++" << ret << _h.abridged(); + cwatch << "+++" << ret << _h; } #if INITIAL_STATE_AS_CHANGES auto ch = logs(ret); diff --git a/libethereum/EthereumHost.cpp b/libethereum/EthereumHost.cpp index fde2ae745..c98dd7642 100644 --- a/libethereum/EthereumHost.cpp +++ b/libethereum/EthereumHost.cpp @@ -61,7 +61,7 @@ bool EthereumHost::ensureInitialised() { // First time - just initialise. m_latestBlockSent = m_chain.currentHash(); - clog(NetNote) << "Initialising: latest=" << m_latestBlockSent.abridged(); + clog(NetNote) << "Initialising: latest=" << m_latestBlockSent; for (auto const& i: m_tq.transactions()) m_transactionsSent.insert(i.first); diff --git a/libethereum/EthereumPeer.cpp b/libethereum/EthereumPeer.cpp index d730771a0..f3edaf8ea 100644 --- a/libethereum/EthereumPeer.cpp +++ b/libethereum/EthereumPeer.cpp @@ -134,7 +134,7 @@ void EthereumPeer::transition(Asking _a, bool _force) clog(NetWarn) << "Bad state: asking for Hashes yet not syncing!"; if (shouldGrabBlocks()) { - clog(NetNote) << "Difficulty of hashchain HIGHER. Grabbing" << m_syncingNeededBlocks.size() << "blocks [latest now" << m_syncingLatestHash.abridged() << ", was" << host()->m_latestBlockSent.abridged() << "]"; + clog(NetNote) << "Difficulty of hashchain HIGHER. Grabbing" << m_syncingNeededBlocks.size() << "blocks [latest now" << m_syncingLatestHash << ", was" << host()->m_latestBlockSent << "]"; host()->m_man.resetToChain(m_syncingNeededBlocks); // host()->m_latestBlockSent = m_syncingLatestHash; @@ -253,7 +253,7 @@ bool EthereumPeer::shouldGrabBlocks() const if (m_syncingNeededBlocks.empty()) return false; - clog(NetNote) << "Should grab blocks? " << td << "vs" << ctd << ";" << m_syncingNeededBlocks.size() << " blocks, ends" << m_syncingNeededBlocks.back().abridged(); + clog(NetNote) << "Should grab blocks? " << td << "vs" << ctd << ";" << m_syncingNeededBlocks.size() << " blocks, ends" << m_syncingNeededBlocks.back(); if (td < ctd || (td == ctd && host()->m_chain.currentHash() == lh)) return false; @@ -280,7 +280,7 @@ void EthereumPeer::attemptSync() unsigned n = host()->m_chain.number(); u256 td = host()->m_chain.details().totalDifficulty; - clog(NetAllDetail) << "Attempt chain-grab? Latest:" << c.abridged() << ", number:" << n << ", TD:" << td << " versus " << m_totalDifficulty; + clog(NetAllDetail) << "Attempt chain-grab? Latest:" << c << ", number:" << n << ", TD:" << td << " versus " << m_totalDifficulty; if (td >= m_totalDifficulty) { clog(NetAllDetail) << "No. Our chain is better."; @@ -310,7 +310,7 @@ bool EthereumPeer::interpret(unsigned _id, RLP const& _r) m_latestHash = _r[3].toHash(); auto genesisHash = _r[4].toHash(); - clog(NetMessageSummary) << "Status:" << m_protocolVersion << "/" << m_networkId << "/" << genesisHash.abridged() << ", TD:" << m_totalDifficulty << "=" << m_latestHash.abridged(); + clog(NetMessageSummary) << "Status:" << m_protocolVersion << "/" << m_networkId << "/" << genesisHash << ", TD:" << m_totalDifficulty << "=" << m_latestHash; if (genesisHash != host()->m_chain.genesisHash()) disable("Invalid genesis hash"); @@ -358,7 +358,7 @@ bool EthereumPeer::interpret(unsigned _id, RLP const& _r) { h256 later = _r[0].toHash(); unsigned limit = _r[1].toInt(); - clog(NetMessageSummary) << "GetBlockHashes (" << limit << "entries," << later.abridged() << ")"; + clog(NetMessageSummary) << "GetBlockHashes (" << limit << "entries," << later << ")"; unsigned c = min(host()->m_chain.number(later), limit); @@ -413,7 +413,7 @@ bool EthereumPeer::interpret(unsigned _id, RLP const& _r) knowns++; m_syncingLastReceivedHash = h; } - clog(NetMessageSummary) << knowns << "knowns," << unknowns << "unknowns; now at" << m_syncingLastReceivedHash.abridged(); + clog(NetMessageSummary) << knowns << "knowns," << unknowns << "unknowns; now at" << m_syncingLastReceivedHash; // run through - ask for more. transition(Asking::Hashes); break; @@ -526,7 +526,7 @@ bool EthereumPeer::interpret(unsigned _id, RLP const& _r) case NewBlockPacket: { auto h = BlockInfo::headerHash(_r[0].data()); - clog(NetMessageSummary) << "NewBlock: " << h.abridged(); + clog(NetMessageSummary) << "NewBlock: " << h; if (_r.itemCount() != 2) disable("NewBlock without 2 data fields."); diff --git a/libethereum/State.cpp b/libethereum/State.cpp index ea2834cc1..d5a54985e 100644 --- a/libethereum/State.cpp +++ b/libethereum/State.cpp @@ -329,7 +329,7 @@ bool State::sync(BlockChain const& _bc, h256 _block, BlockInfo const& _bi, Impor if (m_db.lookup(bi.stateRoot).empty()) { - cwarn << "Unable to sync to" << bi.hash().abridged() << "; state root" << bi.stateRoot.abridged() << "not found in database."; + cwarn << "Unable to sync to" << bi.hash() << "; state root" << bi.stateRoot << "not found in database."; cwarn << "Database corrupt: contains block without stateRoot:" << bi; cwarn << "Bailing."; exit(-1); @@ -500,7 +500,7 @@ pair State::sync(BlockChain const& _bc, TransactionQu else if (i.second.gasPrice() < _gp.ask(*this) * 9 / 10) { // less than 90% of our ask price for gas. drop. - cnote << i.first.abridged() << "Dropping El Cheapo transaction (<90% of ask price)"; + cnote << i.first << "Dropping El Cheapo transaction (<90% of ask price)"; _tq.drop(i.first); } } @@ -512,13 +512,13 @@ pair State::sync(BlockChain const& _bc, TransactionQu if (req > got) { // too old - cnote << i.first.abridged() << "Dropping old transaction (nonce too low)"; + cnote << i.first << "Dropping old transaction (nonce too low)"; _tq.drop(i.first); } else if (got > req + 5) { // too new - cnote << i.first.abridged() << "Dropping new transaction (> 5 nonces ahead)"; + cnote << i.first << "Dropping new transaction (> 5 nonces ahead)"; _tq.drop(i.first); } else @@ -529,7 +529,7 @@ pair State::sync(BlockChain const& _bc, TransactionQu bigint const& got = *boost::get_error_info(e); if (got > m_currentBlock.gasLimit) { - cnote << i.first.abridged() << "Dropping over-gassy transaction (gas > block's gas limit)"; + cnote << i.first << "Dropping over-gassy transaction (gas > block's gas limit)"; _tq.drop(i.first); } else @@ -538,14 +538,14 @@ pair State::sync(BlockChain const& _bc, TransactionQu catch (Exception const& _e) { // Something else went wrong - drop it. - cnote << i.first.abridged() << "Dropping invalid transaction:" << diagnostic_information(_e); + cnote << i.first << "Dropping invalid transaction:" << diagnostic_information(_e); _tq.drop(i.first); } catch (std::exception const&) { // Something else went wrong - drop it. _tq.drop(i.first); - cnote << i.first.abridged() << "Transaction caused low-level exception :("; + cnote << i.first << "Transaction caused low-level exception :("; } } if (chrono::steady_clock::now() > deadline) @@ -709,15 +709,15 @@ void State::cleanup(bool _fullCommit) paranoia("immediately before database commit", true); // Commit the new trie to disk. - clog(StateTrace) << "Committing to disk: stateRoot" << m_currentBlock.stateRoot.abridged() << "=" << rootHash().abridged() << "=" << toHex(asBytes(m_db.lookup(rootHash()))); + clog(StateTrace) << "Committing to disk: stateRoot" << m_currentBlock.stateRoot << "=" << rootHash() << "=" << toHex(asBytes(m_db.lookup(rootHash()))); m_db.commit(); - clog(StateTrace) << "Committed: stateRoot" << m_currentBlock.stateRoot.abridged() << "=" << rootHash().abridged() << "=" << toHex(asBytes(m_db.lookup(rootHash()))); + clog(StateTrace) << "Committed: stateRoot" << m_currentBlock.stateRoot << "=" << rootHash() << "=" << toHex(asBytes(m_db.lookup(rootHash()))); paranoia("immediately after database commit", true); m_previousBlock = m_currentBlock; m_currentBlock.populateFromParent(m_previousBlock); - clog(StateTrace) << "finalising enactment. current -> previous, hash is" << m_previousBlock.hash().abridged(); + clog(StateTrace) << "finalising enactment. current -> previous, hash is" << m_previousBlock.hash(); } else m_db.rollback(); @@ -789,7 +789,7 @@ void State::commitToMine(BlockChain const& _bc) { uncommitToMine(); -// cnote << "Committing to mine on block" << m_previousBlock.hash.abridged(); +// cnote << "Committing to mine on block" << m_previousBlock.hash; #if ETH_PARANOIA && 0 commit(); cnote << "Pre-reward stateRoot:" << m_state.root(); @@ -866,7 +866,7 @@ void State::commitToMine(BlockChain const& _bc) // Commit any and all changes to the trie that are in the cache, then update the state root accordingly. commit(); -// cnote << "Post-reward stateRoot:" << m_state.root().abridged(); +// cnote << "Post-reward stateRoot:" << m_state.root(); // cnote << m_state; // cnote << *this; @@ -890,7 +890,7 @@ void State::completeMine() ret.appendRaw(m_currentUncles); ret.swapOut(m_currentBytes); m_currentBlock.noteDirty(); - cnote << "Mined " << m_currentBlock.hash().abridged() << "(parent: " << m_currentBlock.parentHash.abridged() << ")"; + cnote << "Mined " << m_currentBlock.hash() << "(parent: " << m_currentBlock.parentHash << ")"; StructuredLogger::minedNewBlock( m_currentBlock.hash().abridged(), m_currentBlock.nonce.abridged(), diff --git a/libethereum/State.h b/libethereum/State.h index 85ca30649..d02521c7a 100644 --- a/libethereum/State.h +++ b/libethereum/State.h @@ -174,7 +174,7 @@ public: PoW::assignResult(_result, m_currentBlock); - cnote << "Completed" << m_currentBlock.headerHash(WithoutNonce).abridged() << m_currentBlock.nonce.abridged() << m_currentBlock.difficulty << PoW::verify(m_currentBlock); + cnote << "Completed" << m_currentBlock.headerHash(WithoutNonce) << m_currentBlock.nonce << m_currentBlock.difficulty << PoW::verify(m_currentBlock); completeMine(); diff --git a/libethereum/TransactionQueue.cpp b/libethereum/TransactionQueue.cpp index a4eb5cee8..40eec1ac5 100644 --- a/libethereum/TransactionQueue.cpp +++ b/libethereum/TransactionQueue.cpp @@ -57,7 +57,7 @@ ImportResult TransactionQueue::import(bytesConstRef _transactionRLP, ImportCallb m_known.insert(h); if (_cb) m_callbacks[h] = _cb; - ctxq << "Queued vaguely legit-looking transaction" << h.abridged(); + ctxq << "Queued vaguely legit-looking transaction" << h; m_onReady(); } catch (Exception const& _e) diff --git a/libp2p/Host.cpp b/libp2p/Host.cpp index fff718295..b7a3a929a 100644 --- a/libp2p/Host.cpp +++ b/libp2p/Host.cpp @@ -204,7 +204,7 @@ void Host::startPeerSession(Public const& _id, RLP const& _rlp, RLPXFrameIO* _io stringstream capslog; for (auto cap: caps) capslog << "(" << cap.first << "," << dec << cap.second << ")"; - clog(NetMessageSummary) << "Hello: " << clientVersion << "V[" << protocolVersion << "]" << _id.abridged() << showbase << capslog.str() << dec << listenPort; + clog(NetMessageSummary) << "Hello: " << clientVersion << "V[" << protocolVersion << "]" << _id << showbase << capslog.str() << dec << listenPort; // create session so disconnects are managed auto ps = make_shared(this, _io, p, PeerSessionInfo({_id, clientVersion, _endpoint.address().to_string(), listenPort, chrono::steady_clock::duration(), _rlp[2].toSet(), 0, map()})); @@ -221,7 +221,7 @@ void Host::startPeerSession(Public const& _id, RLP const& _rlp, RLPXFrameIO* _io if(s->isConnected()) { // Already connected. - clog(NetWarn) << "Session already exists for peer with id" << _id.abridged(); + clog(NetWarn) << "Session already exists for peer with id" << _id; ps->disconnect(DuplicatePeer); return; } @@ -238,7 +238,7 @@ void Host::startPeerSession(Public const& _id, RLP const& _rlp, RLPXFrameIO* _io m_sessions[_id] = ps; } - clog(NetNote) << "p2p.host.peer.register" << _id.abridged(); + clog(NetNote) << "p2p.host.peer.register" << _id; StructuredLogger::p2pConnected(_id.abridged(), ps->m_peer->endpoint, ps->m_peer->m_lastConnected, clientVersion, peerCount()); } @@ -466,7 +466,7 @@ void Host::connect(std::shared_ptr const& _p) } bi::tcp::endpoint ep(_p->endpoint); - clog(NetConnect) << "Attempting connection to node" << _p->id.abridged() << "@" << ep << "from" << id().abridged(); + clog(NetConnect) << "Attempting connection to node" << _p->id << "@" << ep << "from" << id(); auto socket = make_shared(new bi::tcp::socket(m_ioService)); socket->ref().async_connect(ep, [=](boost::system::error_code const& ec) { @@ -475,13 +475,13 @@ void Host::connect(std::shared_ptr const& _p) if (ec) { - clog(NetConnect) << "Connection refused to node" << _p->id.abridged() << "@" << ep << "(" << ec.message() << ")"; + clog(NetConnect) << "Connection refused to node" << _p->id << "@" << ep << "(" << ec.message() << ")"; // Manually set error (session not present) _p->m_lastDisconnect = TCPError; } else { - clog(NetConnect) << "Connecting to" << _p->id.abridged() << "@" << ep; + clog(NetConnect) << "Connecting to" << _p->id << "@" << ep; auto handshake = make_shared(this, socket, _p->id); { Guard l(x_connecting); @@ -619,14 +619,14 @@ void Host::startedWorking() runAcceptor(); } else - clog(NetNote) << "p2p.start.notice id:" << id().abridged() << "TCP Listen port is invalid or unavailable."; + clog(NetNote) << "p2p.start.notice id:" << id() << "TCP Listen port is invalid or unavailable."; shared_ptr nodeTable(new NodeTable(m_ioService, m_alias, NodeIPEndpoint(bi::address::from_string(listenAddress()), listenPort(), listenPort()))); nodeTable->setEventHandler(new HostNodeTableHandler(*this)); m_nodeTable = nodeTable; restoreNetwork(&m_restoreNetwork); - clog(NetNote) << "p2p.started id:" << id().abridged(); + clog(NetNote) << "p2p.started id:" << id(); run(boost::system::error_code()); } diff --git a/libp2p/Network.cpp b/libp2p/Network.cpp index 1c780c5e9..de054a178 100644 --- a/libp2p/Network.cpp +++ b/libp2p/Network.cpp @@ -228,7 +228,7 @@ bi::tcp::endpoint Network::resolveHost(string const& _addr) bi::tcp::resolver r(s_resolverIoService); auto it = r.resolve({split[0], toString(port)}, ec); if (ec) - clog(NetWarn) << "Error resolving host address..." << url << _addr << ":" << error << ec.message(); + clog(NetWarn) << "Error resolving host address..." << LogTag::Url << _addr << ":" << LogTag::Error << ec.message(); else ep = *it; } diff --git a/libp2p/NodeTable.cpp b/libp2p/NodeTable.cpp index 4f81e42b9..e324b8f86 100644 --- a/libp2p/NodeTable.cpp +++ b/libp2p/NodeTable.cpp @@ -87,7 +87,7 @@ shared_ptr NodeTable::addNode(Node const& _node) // we handle when tcp endpoint is 0 below if (_node.endpoint.address.to_string() == "0.0.0.0") { - clog(NodeTableWarn) << "addNode Failed. Invalid UDP address" << url << "0.0.0.0" << "for" << _node.id; + clog(NodeTableWarn) << "addNode Failed. Invalid UDP address" << LogTag::Url << "0.0.0.0" << "for" << _node.id; return move(shared_ptr()); } @@ -326,7 +326,7 @@ void NodeTable::noteActiveNode(Public const& _pubk, bi::udp::endpoint const& _en shared_ptr node = nodeEntry(_pubk); if (!!node && !node->pending) { - clog(NodeTableConnect) << "Noting active node:" << _pubk.abridged() << _endpoint.address().to_string() << ":" << _endpoint.port(); + clog(NodeTableConnect) << "Noting active node:" << _pubk << _endpoint.address().to_string() << ":" << _endpoint.port(); node->endpoint.address = _endpoint.address(); node->endpoint.udpPort = _endpoint.port(); @@ -381,7 +381,7 @@ void NodeTable::dropNode(shared_ptr _n) } // notify host - clog(NodeTableUpdate) << "p2p.nodes.drop " << _n->id.abridged(); + clog(NodeTableUpdate) << "p2p.nodes.drop " << _n->id; if (m_nodeEventHandler) m_nodeEventHandler->appendEvent(_n->id, NodeEntryDropped); } @@ -464,7 +464,7 @@ void NodeTable::onReceived(UDPSocketFace*, bi::udp::endpoint const& _from, bytes return; // unsolicited pong; don't note node as active } - clog(NodeTableConnect) << "PONG from " << nodeid.abridged() << _from; + clog(NodeTableConnect) << "PONG from " << nodeid << _from; break; } diff --git a/libp2p/Session.cpp b/libp2p/Session.cpp index 363953a20..8f395158b 100644 --- a/libp2p/Session.cpp +++ b/libp2p/Session.cpp @@ -138,7 +138,7 @@ void Session::serviceNodesRequest() auto rs = randomSelection(peers, 10); for (auto const& i: rs) { - clog(NetTriviaDetail) << "Sending peer " << i.id.abridged() << i.endpoint; + clog(NetTriviaDetail) << "Sending peer " << i.id << i.endpoint; if (i.endpoint.address.is_v4()) s.appendList(3) << bytesConstRef(i.endpoint.address.to_v4().to_bytes().data(), 4) << i.endpoint.tcpPort << i.id; else// if (i.second.address().is_v6()) - assumed @@ -215,7 +215,7 @@ bool Session::interpret(PacketType _t, RLP const& _r) auto ep = bi::tcp::endpoint(peerAddress, _r[i][1].toInt()); NodeId id = _r[i][2].toHash(); - clog(NetAllDetail) << "Checking: " << ep << "(" << id.abridged() << ")"; + clog(NetAllDetail) << "Checking: " << ep << "(" << id << ")"; if (!isPublicAddress(peerAddress)) goto CONTINUE; // Private address. Ignore. @@ -238,7 +238,7 @@ bool Session::interpret(PacketType _t, RLP const& _r) // OK passed all our checks. Assume it's good. addRating(1000); m_server->addNode(id, NodeIPEndpoint(ep.address(), ep.port(), ep.port())); - clog(NetTriviaDetail) << "New peer: " << ep << "(" << id .abridged()<< ")"; + clog(NetTriviaDetail) << "New peer: " << ep << "(" << id << ")"; CONTINUE:; LAMEPEER:; } diff --git a/libweb3jsonrpc/WebThreeStubServerBase.cpp b/libweb3jsonrpc/WebThreeStubServerBase.cpp index 212f3728b..7b124a6f2 100644 --- a/libweb3jsonrpc/WebThreeStubServerBase.cpp +++ b/libweb3jsonrpc/WebThreeStubServerBase.cpp @@ -848,7 +848,7 @@ bool WebThreeStubServerBase::shh_post(Json::Value const& _json) Secret from; if (m.from() && m_ids.count(m.from())) { - cwarn << "Silently signing message from identity" << m.from().abridged() << ": User validation hook goes here."; + cwarn << "Silently signing message from identity" << m.from() << ": User validation hook goes here."; // TODO: insert validification hook here. from = m_ids[m.from()]; } @@ -940,7 +940,7 @@ Json::Value WebThreeStubServerBase::shh_getFilterChanges(string const& _filterId shh::Message m; if (pub) { - cwarn << "Silently decrypting message from identity" << pub.abridged() << ": User validation hook goes here."; + cwarn << "Silently decrypting message from identity" << pub << ": User validation hook goes here."; m = e.open(face()->fullTopic(id), m_ids[pub]); } else @@ -973,7 +973,7 @@ Json::Value WebThreeStubServerBase::shh_getMessages(string const& _filterId) shh::Message m; if (pub) { - cwarn << "Silently decrypting message from identity" << pub.abridged() << ": User validation hook goes here."; + cwarn << "Silently decrypting message from identity" << pub << ": User validation hook goes here."; m = e.open(face()->fullTopic(id), m_ids[pub]); } else diff --git a/test/libdevcrypto/trie.cpp b/test/libdevcrypto/trie.cpp index 0e7125624..3b3fa1dd2 100644 --- a/test/libdevcrypto/trie.cpp +++ b/test/libdevcrypto/trie.cpp @@ -522,17 +522,17 @@ BOOST_AUTO_TEST_CASE(trieStess) cwarn << "Good:" << d2.root(); // for (auto i: dm2.get()) -// cwarn << i.first.abridged() << ": " << RLP(i.second); +// cwarn << i.first << ": " << RLP(i.second); d2.debugStructure(cerr); cwarn << "Broken:" << d.root(); // Leaves an extension -> extension (3c1... -> 742...) // for (auto i: dm.get()) -// cwarn << i.first.abridged() << ": " << RLP(i.second); +// cwarn << i.first << ": " << RLP(i.second); d.debugStructure(cerr); d2.insert(k, v); cwarn << "Pres:" << d2.root(); // for (auto i: dm2.get()) -// cwarn << i.first.abridged() << ": " << RLP(i.second); +// cwarn << i.first << ": " << RLP(i.second); d2.debugStructure(cerr); g_logVerbosity = 99; d2.remove(k); diff --git a/test/libwhisper/whisperTopic.cpp b/test/libwhisper/whisperTopic.cpp index 0ea681b67..3caed5c56 100644 --- a/test/libwhisper/whisperTopic.cpp +++ b/test/libwhisper/whisperTopic.cpp @@ -68,7 +68,7 @@ BOOST_AUTO_TEST_CASE(topic) if (received.count(last)) continue; received.insert(last); - cnote << "New message from:" << msg.from().abridged() << RLP(msg.payload()).toInt(); + cnote << "New message from:" << msg.from() << RLP(msg.payload()).toInt(); result += last; } this_thread::sleep_for(chrono::milliseconds(50)); @@ -137,7 +137,7 @@ BOOST_AUTO_TEST_CASE(forwarding) { Message msg = whost1->envelope(i).open(whost1->fullTopic(w)); unsigned last = RLP(msg.payload()).toInt(); - cnote << "New message from:" << msg.from().abridged() << RLP(msg.payload()).toInt(); + cnote << "New message from:" << msg.from() << RLP(msg.payload()).toInt(); result = last; } this_thread::sleep_for(chrono::milliseconds(50)); @@ -175,7 +175,7 @@ BOOST_AUTO_TEST_CASE(forwarding) for (auto i: whost2->checkWatch(w)) { Message msg = whost2->envelope(i).open(whost2->fullTopic(w)); - cnote << "New message from:" << msg.from().abridged() << RLP(msg.payload()).toInt(); + cnote << "New message from:" << msg.from() << RLP(msg.payload()).toInt(); } this_thread::sleep_for(chrono::milliseconds(50)); } @@ -239,7 +239,7 @@ BOOST_AUTO_TEST_CASE(asyncforwarding) for (auto i: whost1->checkWatch(w)) { Message msg = whost1->envelope(i).open(whost1->fullTopic(w)); - cnote << "New message from:" << msg.from().abridged() << RLP(msg.payload()).toInt(); + cnote << "New message from:" << msg.from() << RLP(msg.payload()).toInt(); } this_thread::sleep_for(chrono::milliseconds(50)); } @@ -283,7 +283,7 @@ BOOST_AUTO_TEST_CASE(asyncforwarding) { Message msg = wh->envelope(i).open(wh->fullTopic(w)); unsigned last = RLP(msg.payload()).toInt(); - cnote << "New message from:" << msg.from().abridged() << RLP(msg.payload()).toInt(); + cnote << "New message from:" << msg.from() << RLP(msg.payload()).toInt(); result = last; } this_thread::sleep_for(chrono::milliseconds(50));