From 3387d82a9c1b438dd298a3048c722d4d1b9fc29b Mon Sep 17 00:00:00 2001 From: Gav Wood Date: Tue, 6 Jan 2015 20:12:54 +0100 Subject: [PATCH] More efficient getLastHashes. --- libethereum/State.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/libethereum/State.cpp b/libethereum/State.cpp index c6a6ce125..e0705859f 100644 --- a/libethereum/State.cpp +++ b/libethereum/State.cpp @@ -1006,9 +1006,9 @@ LastHashes State::getLastHashes(BlockChain const& _bc) const ret.resize(256); if (c_protocolVersion > 49) { - unsigned n = (unsigned)m_previousBlock.number; - for (unsigned i = 0; i < 256; ++i) - ret[i] = _bc.numberHash(std::max(n, i) - i); + ret[0] = _bc.currentHash(); + for (unsigned i = 1; i < 256; ++i) + ret[i] = ret[i - 1] ? _bc.details(ret[i - 1]).parent : h256(); } return ret; }