From 49cf0399f1981d36dd457c7f83785e703dddcf52 Mon Sep 17 00:00:00 2001 From: Warren Togami Date: Mon, 19 Jan 2015 02:26:52 -1000 Subject: [PATCH] Litecoin: Disable PoW Sanity check while loading block index from disk. We use the sha256 hash for the block index for performance reasons, which is recorded for later use. CheckProofOfWork() uses the scrypt hash which is discarded after a block is accepted. While it is technically feasible to verify the PoW, doing so takes several minutes as it requires recomputing every PoW hash during every Litecoin startup. We opt instead to simply trust the data that is on your local disk. --- src/chain.h | 5 +++++ src/txdb.cpp | 10 ++++++++-- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/src/chain.h b/src/chain.h index d834790f0..fe5e9a6cc 100644 --- a/src/chain.h +++ b/src/chain.h @@ -215,6 +215,11 @@ public: return *phashBlock; } + uint256 GetBlockPoWHash() const + { + return GetBlockHeader().GetPoWHash(); + } + int64_t GetBlockTime() const { return (int64_t)nTime; diff --git a/src/txdb.cpp b/src/txdb.cpp index 0731d843f..0cd05f4d3 100644 --- a/src/txdb.cpp +++ b/src/txdb.cpp @@ -212,8 +212,14 @@ bool CBlockTreeDB::LoadBlockIndexGuts() pindexNew->nStatus = diskindex.nStatus; pindexNew->nTx = diskindex.nTx; - if (!CheckProofOfWork(pindexNew->GetBlockHash(), pindexNew->nBits)) - return error("LoadBlockIndex() : CheckProofOfWork failed: %s", pindexNew->ToString()); + // Litecoin: Disable PoW Sanity check while loading block index from disk. + // We use the sha256 hash for the block index for performance reasons, which is recorded for later use. + // CheckProofOfWork() uses the scrypt hash which is discarded after a block is accepted. + // While it is technically feasible to verify the PoW, doing so takes several minutes as it + // requires recomputing every PoW hash during every Litecoin startup. + // We opt instead to simply trust the data that is on your local disk. + //if (!CheckProofOfWork(pindexNew->GetBlockPoWHash(), pindexNew->nBits)) + // return error("LoadBlockIndex() : CheckProofOfWork failed: %s", pindexNew->ToString()); pcursor->Next(); } else {