aboutsummaryrefslogtreecommitdiff
path: root/src/wallet
diff options
context:
space:
mode:
authorAva Chow <github@achow101.com>2024-04-22 17:08:18 -0400
committerAva Chow <github@achow101.com>2024-05-16 15:03:13 -0400
commitd51fbab4b32d56765e8faab6ad01245fb259b0ca (patch)
tree63c106f4ec20b2c61c8f436acb38a5dfb130f0c2 /src/wallet
parent0b753156ce60c29efb2386954ba7555ad8f642f5 (diff)
downloadbitcoin-d51fbab4b32d56765e8faab6ad01245fb259b0ca.tar.xz
wallet, test: Be able to always swap BDB endianness
Diffstat (limited to 'src/wallet')
-rw-r--r--src/wallet/init.cpp3
-rw-r--r--src/wallet/wallet.cpp5
2 files changed, 7 insertions, 1 deletions
diff --git a/src/wallet/init.cpp b/src/wallet/init.cpp
index f151fad740..cbdce88810 100644
--- a/src/wallet/init.cpp
+++ b/src/wallet/init.cpp
@@ -87,8 +87,9 @@ void WalletInit::AddWalletOptions(ArgsManager& argsman) const
argsman.AddArg("-dblogsize=<n>", strprintf("Flush wallet database activity from memory to disk log every <n> megabytes (default: %u)", DatabaseOptions().max_log_mb), ArgsManager::ALLOW_ANY | ArgsManager::DEBUG_ONLY, OptionsCategory::WALLET_DEBUG_TEST);
argsman.AddArg("-flushwallet", strprintf("Run a thread to flush wallet periodically (default: %u)", DEFAULT_FLUSHWALLET), ArgsManager::ALLOW_ANY | ArgsManager::DEBUG_ONLY, OptionsCategory::WALLET_DEBUG_TEST);
argsman.AddArg("-privdb", strprintf("Sets the DB_PRIVATE flag in the wallet db environment (default: %u)", !DatabaseOptions().use_shared_memory), ArgsManager::ALLOW_ANY | ArgsManager::DEBUG_ONLY, OptionsCategory::WALLET_DEBUG_TEST);
+ argsman.AddArg("-swapbdbendian", "Swaps the internal endianness of BDB wallet databases (default: false)", ArgsManager::ALLOW_ANY | ArgsManager::DEBUG_ONLY, OptionsCategory::WALLET_DEBUG_TEST);
#else
- argsman.AddHiddenArgs({"-dblogsize", "-flushwallet", "-privdb"});
+ argsman.AddHiddenArgs({"-dblogsize", "-flushwallet", "-privdb", "-swapbdbendian"});
#endif
#ifdef USE_SQLITE
diff --git a/src/wallet/wallet.cpp b/src/wallet/wallet.cpp
index 96c4397504..5a8df5790e 100644
--- a/src/wallet/wallet.cpp
+++ b/src/wallet/wallet.cpp
@@ -375,7 +375,12 @@ std::shared_ptr<CWallet> CreateWallet(WalletContext& context, const std::string&
uint64_t wallet_creation_flags = options.create_flags;
const SecureString& passphrase = options.create_passphrase;
+ ArgsManager& args = *Assert(context.args);
+
if (wallet_creation_flags & WALLET_FLAG_DESCRIPTORS) options.require_format = DatabaseFormat::SQLITE;
+ else if (args.GetBoolArg("-swapbdbendian", false)) {
+ options.require_format = DatabaseFormat::BERKELEY_SWAP;
+ }
// Indicate that the wallet is actually supposed to be blank and not just blank to make it encrypted
bool create_blank = (wallet_creation_flags & WALLET_FLAG_BLANK_WALLET);