From fc6e35060d5e8792a83c4fabb7cd82c283e46fce Mon Sep 17 00:00:00 2001 From: Kittywhiskers Van Gogh <63189531+kittywhiskers@users.noreply.github.com> Date: Sun, 12 Dec 2021 18:57:02 +0530 Subject: [PATCH] merge bitcoin#16796: Fix segfault in CreateWalletFromFile --- src/init.cpp | 2 +- src/wallet/load.h | 4 +-- src/wallet/wallet.cpp | 2 +- .../data/wallets/high_minversion/.walletlock | 0 .../data/wallets/high_minversion/db.log | 0 .../data/wallets/high_minversion/wallet.dat | Bin 0 -> 16384 bytes test/functional/test_framework/util.py | 8 ++++-- test/functional/wallet_multiwallet.py | 25 ++++++++++++++++++ 8 files changed, 35 insertions(+), 6 deletions(-) create mode 100644 test/functional/data/wallets/high_minversion/.walletlock create mode 100644 test/functional/data/wallets/high_minversion/db.log create mode 100644 test/functional/data/wallets/high_minversion/wallet.dat diff --git a/src/init.cpp b/src/init.cpp index 06a1459e46..c9bc43907d 100644 --- a/src/init.cpp +++ b/src/init.cpp @@ -1469,7 +1469,7 @@ bool AppInitParameterInteraction() if (!ParseMoney(gArgs.GetArg("-minrelaytxfee", ""), n)) { return InitError(AmountErrMsg("minrelaytxfee", gArgs.GetArg("-minrelaytxfee", ""))); } - // High fee check is done afterward in WalletParameterInteraction() + // High fee check is done afterward in CWallet::CreateWalletFromFile() ::minRelayTxFee = CFeeRate(n); } else if (incrementalRelayFee > ::minRelayTxFee) { // Allow only setting incrementalRelayFee to control both diff --git a/src/wallet/load.h b/src/wallet/load.h index 9bb6f2166e..7420d81b16 100644 --- a/src/wallet/load.h +++ b/src/wallet/load.h @@ -16,8 +16,8 @@ class Chain; } // namespace interfaces //! Responsible for reading and validating the -wallet arguments and verifying the wallet database. -//! This function will perform salvage on the wallet if requested, as long as only one wallet is -//! being loaded (WalletParameterInteraction forbids -salvagewallet, -zapwallettxes or -upgradewallet with multiwallet). +// This function will perform salvage on the wallet if requested, as long as only one wallet is +// being loaded (WalletInit::ParameterInteraction() forbids -salvagewallet, -zapwallettxes or -upgradewallet with multiwallet). bool VerifyWallets(interfaces::Chain& chain, const std::vector& wallet_files); //! Load wallet databases. diff --git a/src/wallet/wallet.cpp b/src/wallet/wallet.cpp index 30f1f38031..7d1851c62f 100644 --- a/src/wallet/wallet.cpp +++ b/src/wallet/wallet.cpp @@ -4885,7 +4885,7 @@ bool CWallet::Verify(interfaces::Chain& chain, const WalletLocation& location, b std::shared_ptr CWallet::CreateWalletFromFile(interfaces::Chain& chain, const WalletLocation& location, uint64_t wallet_creation_flags) { - const std::string& walletFile = WalletDataFilePath(location.GetPath()).string(); + const std::string walletFile = WalletDataFilePath(location.GetPath()).string(); // needed to restore wallet transaction meta data after -zapwallettxes std::vector vWtx; diff --git a/test/functional/data/wallets/high_minversion/.walletlock b/test/functional/data/wallets/high_minversion/.walletlock new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/functional/data/wallets/high_minversion/db.log b/test/functional/data/wallets/high_minversion/db.log new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/functional/data/wallets/high_minversion/wallet.dat b/test/functional/data/wallets/high_minversion/wallet.dat new file mode 100644 index 0000000000000000000000000000000000000000..99ab8092631c4a7da2236f46e7250e6c265d3b49 GIT binary patch literal 16384 zcmeI&u}i~16vy#*(Nvobr|srq5Cm}%aT7sManxA^wXso3+Z0;yZ*XvNbaQYl2re#y zgMuJV;w&ysI#h6Q^e#1}N(Z+(d=HL$?Ir2;v;BAx5m9E^5lp+1w#AT{aUs%YKX(k@ z)DOp=OquoMDYw#CO0{>L@5(o8^33)o1p){lfB*srAbE+|5k#500IagfB*srAblYQd{CSHZSTHY z|3B&JC;!Md#b5IO@An3h`&kh{009ILKmY**5I_I{1Q0-=Hv%^Qcjk3Z3a0=6tRMA< ze$x$os&DkAKGX&CJ^%v&1Q0*~0R#|0009ILKmY**x(kepx_@y*rN*M=;gQVR-C1^P z@pb)b;(B#D0iov->tW