From f50af8e10ea7061ec76e55b5173a3099f01a42d5 Mon Sep 17 00:00:00 2001 From: Gav Wood Date: Thu, 28 Aug 2014 22:15:59 +0200 Subject: [PATCH] Queue diagnostics. --- libethereum/BlockQueue.cpp | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/libethereum/BlockQueue.cpp b/libethereum/BlockQueue.cpp index 3f636b102..110137537 100644 --- a/libethereum/BlockQueue.cpp +++ b/libethereum/BlockQueue.cpp @@ -33,11 +33,16 @@ bool BlockQueue::import(bytesConstRef _block, BlockChain const& _bc) // Check if we already know this block. h256 h = sha3(_block); + cnote << "Queuing block" << h.abridged() << "for import..."; + UpgradableGuard l(m_lock); if (m_readySet.count(h) || m_drainingSet.count(h) || m_futureSet.count(h)) + { // Already know about this one. + cnote << "Already known."; return false; + } // VERIFY: populates from the block and checks the block is internally coherent. BlockInfo bi; @@ -60,11 +65,17 @@ bool BlockQueue::import(bytesConstRef _block, BlockChain const& _bc) // Check block doesn't already exist first! if (_bc.details(newHash)) + { + cnote << "Already known in chain."; return false; + } // Check it's not crazy if (bi.timestamp > (u256)time(0)) + { + cnote << "Invalid timestamp."; return false; + } { UpgradeGuard ul(l); @@ -73,12 +84,14 @@ bool BlockQueue::import(bytesConstRef _block, BlockChain const& _bc) if (!m_readySet.count(bi.parentHash) && !m_drainingSet.count(bi.parentHash) && !_bc.details(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. + cnote << "OK - queued for future."; m_future.insert(make_pair(bi.parentHash, make_pair(h, _block.toBytes()))); m_futureSet.insert(h); } else { // If valid, append to blocks. + cnote << "OK - ready for chain insertion."; m_ready.push_back(_block.toBytes()); m_readySet.insert(h);