diff options
Diffstat (limited to 'src/index')
-rw-r--r-- | src/index/base.cpp | 19 | ||||
-rw-r--r-- | src/index/base.h | 2 | ||||
-rw-r--r-- | src/index/blockfilterindex.cpp | 7 | ||||
-rw-r--r-- | src/index/blockfilterindex.h | 2 | ||||
-rw-r--r-- | src/index/coinstatsindex.cpp | 3 | ||||
-rw-r--r-- | src/index/coinstatsindex.h | 2 | ||||
-rw-r--r-- | src/index/disktxpos.h | 12 | ||||
-rw-r--r-- | src/index/txindex.cpp | 3 | ||||
-rw-r--r-- | src/index/txindex.h | 2 |
9 files changed, 27 insertions, 25 deletions
diff --git a/src/index/base.cpp b/src/index/base.cpp index 3eea09b17d..8a311296c2 100644 --- a/src/index/base.cpp +++ b/src/index/base.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2017-2021 The Bitcoin Core developers +// Copyright (c) 2017-2022 The Bitcoin Core developers // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. @@ -6,8 +6,10 @@ #include <index/base.h> #include <interfaces/chain.h> #include <kernel/chain.h> +#include <logging.h> #include <node/blockstorage.h> #include <node/context.h> +#include <node/database_args.h> #include <node/interface_ui.h> #include <shutdown.h> #include <tinyformat.h> @@ -34,7 +36,7 @@ static void FatalError(const char* fmt, const Args&... args) std::string strMessage = tfm::format(fmt, args...); SetMiscWarning(Untranslated(strMessage)); LogPrintf("*** %s\n", strMessage); - AbortError(_("A fatal internal error occurred, see debug.log for details")); + InitError(_("A fatal internal error occurred, see debug.log for details")); StartShutdown(); } @@ -48,7 +50,13 @@ CBlockLocator GetLocator(interfaces::Chain& chain, const uint256& block_hash) } BaseIndex::DB::DB(const fs::path& path, size_t n_cache_size, bool f_memory, bool f_wipe, bool f_obfuscate) : - CDBWrapper(path, n_cache_size, f_memory, f_wipe, f_obfuscate) + CDBWrapper{DBParams{ + .path = path, + .cache_bytes = n_cache_size, + .memory_only = f_memory, + .wipe_data = f_wipe, + .obfuscate = f_obfuscate, + .options = [] { DBOptions options; node::ReadDatabaseArgs(gArgs, options); return options; }()}} {} bool BaseIndex::DB::ReadBestBlock(CBlockLocator& locator) const @@ -415,8 +423,9 @@ IndexSummary BaseIndex::GetSummary() const return summary; } -void BaseIndex::SetBestBlockIndex(const CBlockIndex* block) { - assert(!node::fPruneMode || AllowPrune()); +void BaseIndex::SetBestBlockIndex(const CBlockIndex* block) +{ + assert(!m_chainstate->m_blockman.IsPruneMode() || AllowPrune()); if (AllowPrune() && block) { node::PruneLockInfo prune_lock; diff --git a/src/index/base.h b/src/index/base.h index 54c59f7557..231f36b605 100644 --- a/src/index/base.h +++ b/src/index/base.h @@ -1,4 +1,4 @@ -// Copyright (c) 2017-2021 The Bitcoin Core developers +// Copyright (c) 2017-2022 The Bitcoin Core developers // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. diff --git a/src/index/blockfilterindex.cpp b/src/index/blockfilterindex.cpp index 292e11c874..43c2215338 100644 --- a/src/index/blockfilterindex.cpp +++ b/src/index/blockfilterindex.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2018-2021 The Bitcoin Core developers +// Copyright (c) 2018-2022 The Bitcoin Core developers // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. @@ -8,6 +8,7 @@ #include <hash.h> #include <index/blockfilterindex.h> #include <node/blockstorage.h> +#include <util/fs_helpers.h> #include <util/system.h> #include <validation.h> @@ -157,9 +158,7 @@ bool BlockFilterIndex::ReadFilterFromDisk(const FlatFilePos& pos, const uint256& std::vector<uint8_t> encoded_filter; try { filein >> block_hash >> encoded_filter; - uint256 result; - CHash256().Write(encoded_filter).Finalize(result); - if (result != hash) return error("Checksum mismatch in filter decode."); + if (Hash(encoded_filter) != hash) return error("Checksum mismatch in filter decode."); filter = BlockFilter(GetFilterType(), block_hash, std::move(encoded_filter), /*skip_decode_check=*/true); } catch (const std::exception& e) { diff --git a/src/index/blockfilterindex.h b/src/index/blockfilterindex.h index 9e69388dc8..ce1961c776 100644 --- a/src/index/blockfilterindex.h +++ b/src/index/blockfilterindex.h @@ -1,4 +1,4 @@ -// Copyright (c) 2018-2021 The Bitcoin Core developers +// Copyright (c) 2018-2022 The Bitcoin Core developers // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. diff --git a/src/index/coinstatsindex.cpp b/src/index/coinstatsindex.cpp index 271e5bb1f6..4d637e217a 100644 --- a/src/index/coinstatsindex.cpp +++ b/src/index/coinstatsindex.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2020-2021 The Bitcoin Core developers +// Copyright (c) 2020-2022 The Bitcoin Core developers // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. @@ -7,6 +7,7 @@ #include <crypto/muhash.h> #include <index/coinstatsindex.h> #include <kernel/coinstats.h> +#include <logging.h> #include <node/blockstorage.h> #include <serialize.h> #include <txdb.h> diff --git a/src/index/coinstatsindex.h b/src/index/coinstatsindex.h index aa0d7f9fd5..21ce4c4767 100644 --- a/src/index/coinstatsindex.h +++ b/src/index/coinstatsindex.h @@ -1,4 +1,4 @@ -// Copyright (c) 2020-2021 The Bitcoin Core developers +// Copyright (c) 2020-2022 The Bitcoin Core developers // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. diff --git a/src/index/disktxpos.h b/src/index/disktxpos.h index 3166053226..7718755b78 100644 --- a/src/index/disktxpos.h +++ b/src/index/disktxpos.h @@ -10,7 +10,7 @@ struct CDiskTxPos : public FlatFilePos { - unsigned int nTxOffset; // after header + unsigned int nTxOffset{0}; // after header SERIALIZE_METHODS(CDiskTxPos, obj) { @@ -21,15 +21,7 @@ struct CDiskTxPos : public FlatFilePos CDiskTxPos(const FlatFilePos &blockIn, unsigned int nTxOffsetIn) : FlatFilePos(blockIn.nFile, blockIn.nPos), nTxOffset(nTxOffsetIn) { } - CDiskTxPos() { - SetNull(); - } - - void SetNull() { - FlatFilePos::SetNull(); - nTxOffset = 0; - } + CDiskTxPos() {} }; - #endif // BITCOIN_INDEX_DISKTXPOS_H diff --git a/src/index/txindex.cpp b/src/index/txindex.cpp index a4fe1b611e..9095e7afeb 100644 --- a/src/index/txindex.cpp +++ b/src/index/txindex.cpp @@ -1,10 +1,11 @@ -// Copyright (c) 2017-2021 The Bitcoin Core developers +// Copyright (c) 2017-2022 The Bitcoin Core developers // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. #include <index/txindex.h> #include <index/disktxpos.h> +#include <logging.h> #include <node/blockstorage.h> #include <util/system.h> #include <validation.h> diff --git a/src/index/txindex.h b/src/index/txindex.h index 4cea35045d..ef835fe5d7 100644 --- a/src/index/txindex.h +++ b/src/index/txindex.h @@ -1,4 +1,4 @@ -// Copyright (c) 2017-2021 The Bitcoin Core developers +// Copyright (c) 2017-2022 The Bitcoin Core developers // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. |