From 004b184b027520a4f9019d1432a816e6ec891fe3 Mon Sep 17 00:00:00 2001 From: Cory Fields Date: Thu, 6 Jul 2023 19:29:27 +0000 Subject: [PATCH] wallet: bdb: move BerkeleyDatabase constructor to cpp file Else some compilers/stdlibs may not be able to construct std::unique_ptr without Db defined. --- src/wallet/bdb.cpp | 7 +++++++ src/wallet/bdb.h | 7 +------ 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/src/wallet/bdb.cpp b/src/wallet/bdb.cpp index 26938e0a7d..d74950c5b1 100644 --- a/src/wallet/bdb.cpp +++ b/src/wallet/bdb.cpp @@ -296,6 +296,13 @@ static Span SpanFromDbt(const SafeDbt& dbt) return {reinterpret_cast(dbt.get_data()), dbt.get_size()}; } +BerkeleyDatabase::BerkeleyDatabase(std::shared_ptr env, fs::path filename, const DatabaseOptions& options) : + WalletDatabase(), env(std::move(env)), m_filename(std::move(filename)), m_max_log_mb(options.max_log_mb) +{ + auto inserted = this->env->m_databases.emplace(m_filename, std::ref(*this)); + assert(inserted.second); +} + bool BerkeleyDatabase::Verify(bilingual_str& errorStr) { fs::path walletDir = env->Directory(); diff --git a/src/wallet/bdb.h b/src/wallet/bdb.h index da32195dc6..0470a3183a 100644 --- a/src/wallet/bdb.h +++ b/src/wallet/bdb.h @@ -84,12 +84,7 @@ public: BerkeleyDatabase() = delete; /** Create DB handle to real database */ - BerkeleyDatabase(std::shared_ptr env, fs::path filename, const DatabaseOptions& options) : - WalletDatabase(), env(std::move(env)), m_filename(std::move(filename)), m_max_log_mb(options.max_log_mb) - { - auto inserted = this->env->m_databases.emplace(m_filename, std::ref(*this)); - assert(inserted.second); - } + BerkeleyDatabase(std::shared_ptr env, fs::path filename, const DatabaseOptions& options); ~BerkeleyDatabase() override;