Skip to content

Commit de5e91c

Browse files
committed
refactor: Add BerkeleyDatabaseVersion() function
1 parent eb2ffbb commit de5e91c

File tree

3 files changed

+12
-4
lines changed

3 files changed

+12
-4
lines changed

src/qt/rpcconsole.cpp

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
#include <univalue.h>
2525

2626
#ifdef ENABLE_WALLET
27-
#include <db_cxx.h>
27+
#include <wallet/db.h>
2828
#include <wallet/wallet.h>
2929
#endif
3030

@@ -34,9 +34,10 @@
3434
#include <QScrollBar>
3535
#include <QScreen>
3636
#include <QSettings>
37+
#include <QString>
38+
#include <QStringList>
3739
#include <QTime>
3840
#include <QTimer>
39-
#include <QStringList>
4041

4142
// TODO: add a scrollback limit, as there is currently none
4243
// TODO: make it possible to filter out categories (esp debug messages when implemented)
@@ -480,7 +481,7 @@ RPCConsole::RPCConsole(interfaces::Node& node, const PlatformStyle *_platformSty
480481

481482
// set library version labels
482483
#ifdef ENABLE_WALLET
483-
ui->berkeleyDBVersion->setText(DbEnv::version(nullptr, nullptr, nullptr));
484+
ui->berkeleyDBVersion->setText(QString::fromStdString(BerkeleyDatabaseVersion()));
484485
#else
485486
ui->label_berkeleyDBVersion->hide();
486487
ui->berkeleyDBVersion->hide();

src/wallet/db.cpp

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -399,7 +399,7 @@ bool BerkeleyBatch::VerifyEnvironment(const fs::path& file_path, bilingual_str&
399399
std::shared_ptr<BerkeleyEnvironment> env = GetWalletEnv(file_path, walletFile);
400400
fs::path walletDir = env->Directory();
401401

402-
LogPrintf("Using BerkeleyDB version %s\n", DbEnv::version(nullptr, nullptr, nullptr));
402+
LogPrintf("Using BerkeleyDB version %s\n", BerkeleyDatabaseVersion());
403403
LogPrintf("Using wallet %s\n", file_path.string());
404404

405405
if (!env->Open(true /* retry */)) {
@@ -916,3 +916,8 @@ void BerkeleyDatabase::ReloadDbEnv()
916916
env->ReloadDbEnv();
917917
}
918918
}
919+
920+
std::string BerkeleyDatabaseVersion()
921+
{
922+
return DbEnv::version(nullptr, nullptr, nullptr);
923+
}

src/wallet/db.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -402,4 +402,6 @@ class BerkeleyBatch
402402
bool static Rewrite(BerkeleyDatabase& database, const char* pszSkip = nullptr);
403403
};
404404

405+
std::string BerkeleyDatabaseVersion();
406+
405407
#endif // BITCOIN_WALLET_DB_H

0 commit comments

Comments
 (0)