diff options
author | Wladimir J. van der Laan <laanwj@protonmail.com> | 2021-01-17 17:21:21 +0100 |
---|---|---|
committer | Wladimir J. van der Laan <laanwj@protonmail.com> | 2021-01-17 18:10:20 +0100 |
commit | ad57fb756b1c2df625790bd9c296ec28daa93740 (patch) | |
tree | 5046596f65379b72d6f563ebe8c95bdf586e1735 /src/wallet/init.cpp | |
parent | 30e664dcce1a9adb9ba9a29e4f0cf809767870dd (diff) |
wallet: Add BerkeleyDB version sanity check at init time
Detect version conflicts between the run-time BerkeleyDB library and the one used during compilation.
This is very unsafe (can result in anything from crashes to corruption) so shut down when one is detected.
Diffstat (limited to 'src/wallet/init.cpp')
-rw-r--r-- | src/wallet/init.cpp | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/src/wallet/init.cpp b/src/wallet/init.cpp index 085dde1026..0d2be64dfb 100644 --- a/src/wallet/init.cpp +++ b/src/wallet/init.cpp @@ -86,6 +86,11 @@ void WalletInit::AddWalletOptions(ArgsManager& argsman) const bool WalletInit::ParameterInteraction() const { +#ifdef USE_BDB + if (!BerkeleyDatabaseSanityCheck()) { + return InitError(Untranslated("A version conflict was detected between the run-time BerkeleyDB library and the one used during compilation.")); + } +#endif if (gArgs.GetBoolArg("-disablewallet", DEFAULT_DISABLE_WALLET)) { for (const std::string& wallet : gArgs.GetArgs("-wallet")) { LogPrintf("%s: parameter interaction: -disablewallet -> ignoring -wallet=%s\n", __func__, wallet); |