diff --git a/libethereum/BlockChain.cpp b/libethereum/BlockChain.cpp index 79cccd4ef..ae628dba6 100644 --- a/libethereum/BlockChain.cpp +++ b/libethereum/BlockChain.cpp @@ -276,7 +276,10 @@ h256s BlockChain::import(bytes const& _block, OverlayDB const& _db) auto pd = details(bi.parentHash); if (!pd) + { cwarn << "Odd: details is returning false despite block known:" << RLP(pd.rlp()); + cwarn << "Block:" << RLP(block(bi.parentHash)); + } // Check it's not crazy if (bi.timestamp > (u256)time(0)) @@ -479,13 +482,16 @@ bytes BlockChain::block(h256 _hash) const string d; m_db->Get(m_readOptions, ldb::Slice((char const*)&_hash, 32), &d); + if (!d.size()) + { + cwarn << "Couldn't find requested block:" << _hash.abridged(); + return d; + } + WriteGuard l(x_cache); m_cache[_hash].resize(d.size()); memcpy(m_cache[_hash].data(), d.data(), d.size()); - if (!d.size()) - cwarn << "Couldn't find requested block:" << _hash.abridged(); - return m_cache[_hash]; } diff --git a/libethereum/EthereumPeer.cpp b/libethereum/EthereumPeer.cpp index 67721a083..7950c489f 100644 --- a/libethereum/EthereumPeer.cpp +++ b/libethereum/EthereumPeer.cpp @@ -203,7 +203,7 @@ bool EthereumPeer::interpret(RLP const& _r) for (unsigned i = 1; i < _r.itemCount(); ++i) { auto h = _r[i].toHash(); - if (host()->m_chain.details(h)) + if (host()->m_chain.isKnown(h)) { host()->noteHaveChain(this); return true;