mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-06-04 18:22:57 +02:00
refactor: Add Chainstate::StoragePath() method
Use to simplify code determining the chainstate leveldb paths. New method is the now the only code that needs to figure out the storage path, so the path doesn't need to be constructed multiple places and backed out of leveldb.
This commit is contained in:
@@ -191,12 +191,6 @@ private:
|
||||
//! obfuscation key storage key, null-prefixed to avoid collisions
|
||||
inline static const std::string OBFUSCATION_KEY{"\000obfuscate_key", 14}; // explicit size to avoid truncation at leading \0
|
||||
|
||||
//! path to filesystem storage
|
||||
const fs::path m_path;
|
||||
|
||||
//! whether or not the database resides in memory
|
||||
bool m_is_memory;
|
||||
|
||||
std::optional<std::string> ReadImpl(std::span<const std::byte> key) const;
|
||||
bool ExistsImpl(std::span<const std::byte> key) const;
|
||||
size_t EstimateSizeImpl(std::span<const std::byte> key1, std::span<const std::byte> key2) const;
|
||||
@@ -237,14 +231,6 @@ public:
|
||||
WriteBatch(batch, fSync);
|
||||
}
|
||||
|
||||
//! @returns filesystem path to the on-disk data.
|
||||
std::optional<fs::path> StoragePath() {
|
||||
if (m_is_memory) {
|
||||
return {};
|
||||
}
|
||||
return m_path;
|
||||
}
|
||||
|
||||
template <typename K>
|
||||
bool Exists(const K& key) const
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user