From df9eb5e14fa8072bc8a82b59e712c2ba36f13f4c Mon Sep 17 00:00:00 2001 From: Pieter Wuille Date: Sun, 20 Apr 2014 03:19:20 +0200 Subject: Move {Get,Set}Compact from bignum to uint256 --- src/txdb.cpp | 6 ------ 1 file changed, 6 deletions(-) (limited to 'src/txdb.cpp') diff --git a/src/txdb.cpp b/src/txdb.cpp index cb92922a3..4eab8525a 100644 --- a/src/txdb.cpp +++ b/src/txdb.cpp @@ -73,12 +73,6 @@ bool CBlockTreeDB::WriteBlockIndex(const CDiskBlockIndex& blockindex) return Write(make_pair('b', blockindex.GetBlockHash()), blockindex); } -bool CBlockTreeDB::WriteBestInvalidWork(const CBigNum& bnBestInvalidWork) -{ - // Obsolete; only written for backward compatibility. - return Write('I', bnBestInvalidWork); -} - bool CBlockTreeDB::WriteBlockFileInfo(int nFile, const CBlockFileInfo &info) { return Write(make_pair('f', nFile), info); } -- cgit v1.2.3 From df852d2bcc6573a3fcb3e59f82f7ea4dfa11290e Mon Sep 17 00:00:00 2001 From: jtimon Date: Mon, 10 Mar 2014 08:46:53 -0700 Subject: Refactor proof of work related functions out of main --- src/txdb.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'src/txdb.cpp') diff --git a/src/txdb.cpp b/src/txdb.cpp index 4eab8525a..92137f71f 100644 --- a/src/txdb.cpp +++ b/src/txdb.cpp @@ -6,6 +6,7 @@ #include "txdb.h" #include "core.h" +#include "pow.h" #include "uint256.h" #include @@ -212,8 +213,8 @@ bool CBlockTreeDB::LoadBlockIndexGuts() pindexNew->nStatus = diskindex.nStatus; pindexNew->nTx = diskindex.nTx; - if (!pindexNew->CheckIndex()) - return error("LoadBlockIndex() : CheckIndex failed: %s", pindexNew->ToString()); + if (!CheckProofOfWork(pindexNew->GetBlockHash(), pindexNew->nBits)) + return error("LoadBlockIndex() : CheckProofOfWork failed: %s", pindexNew->ToString()); pcursor->Next(); } else { -- cgit v1.2.3 From dd638dd712861a2fc419fe9b2b064ae303b074e6 Mon Sep 17 00:00:00 2001 From: "Wladimir J. van der Laan" Date: Wed, 25 Jun 2014 13:45:29 +0200 Subject: typedef std::map to CCoinsMap This makes it possible to switch to a more efficient map type without changing all occurences manually. Merges half of #4413. --- src/txdb.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/txdb.cpp') diff --git a/src/txdb.cpp b/src/txdb.cpp index 92137f71f..52cd96283 100644 --- a/src/txdb.cpp +++ b/src/txdb.cpp @@ -54,11 +54,11 @@ bool CCoinsViewDB::SetBestBlock(const uint256 &hashBlock) { return db.WriteBatch(batch); } -bool CCoinsViewDB::BatchWrite(const std::map &mapCoins, const uint256 &hashBlock) { +bool CCoinsViewDB::BatchWrite(const CCoinsMap &mapCoins, const uint256 &hashBlock) { LogPrint("coindb", "Committing %u changed transactions to coin database...\n", (unsigned int)mapCoins.size()); CLevelDBBatch batch; - for (std::map::const_iterator it = mapCoins.begin(); it != mapCoins.end(); it++) + for (CCoinsMap::const_iterator it = mapCoins.begin(); it != mapCoins.end(); it++) BatchWriteCoins(batch, it->first, it->second); if (hashBlock != uint256(0)) BatchWriteHashBestChain(batch, hashBlock); -- cgit v1.2.3