diff options
author | Wladimir J. van der Laan <laanwj@gmail.com> | 2018-11-20 15:15:51 +0100 |
---|---|---|
committer | Wladimir J. van der Laan <laanwj@gmail.com> | 2018-11-20 15:15:59 +0100 |
commit | afa506f6ebebd55a207ef2fa8674a2c9a6209325 (patch) | |
tree | 23240bb0257b422fbba924af7b59f90ec877e02e /src/wallet/walletutil.cpp | |
parent | 1b99d153d0713ec62b3bde7adbe78c271b5a36ea (diff) | |
parent | 591203149f1700f594f781862e88cbbfe83d8d37 (diff) |
Merge #14552: wallet: detecting duplicate wallet by comparing the db filename.
591203149f1700f594f781862e88cbbfe83d8d37 wallet: Create IsDatabaseLoaded function (Chun Kuan Lee)
15c93f075a881deb3ad7b1dd8a4516a9b06e5e11 wallet: Add trailing wallet.dat when detecting duplicate wallet if it's a directory. (Chun Kuan Lee)
c456fbd8dfcc748e5ec9feaa57ec0f2900f99cde Refactor: Move m_db pointers into BerkeleyDatabase (Russell Yanofsky)
Pull request description:
Fix #14538
Fix crash attempting to load the same wallet with different path strings that resolve to the same absolute path. The primary check which prevents loading the same wallet twice is:
https://github.com/bitcoin/bitcoin/blob/6b8d0a2164b30eab76e7bccb1ffb056a10fba406/src/wallet/db.cpp#L44
But this check is skipped if both wallet paths resolve to the same absolute path, due to caching here:
https://github.com/bitcoin/bitcoin/blob/6b8d0a2164b30eab76e7bccb1ffb056a10fba406/src/wallet/db.cpp#L467
Meanwhile a secondary check for duplicate wallets is not reliable because it based on a literal comparison, instead of comparison using absolute paths:
https://github.com/bitcoin/bitcoin/blob/6b8d0a2164b30eab76e7bccb1ffb056a10fba406/src/wallet/wallet.cpp#L3853
This PR fixes the latter check to compare the absolute path of a new wallet being loaded to absolute paths of wallets already loaded, so there should no longer be any way to load the same wallet more than once.
Tree-SHA512: 2fa01811c160b57be3b76c6b4983556a04bbce71a3f8202429987ec020664a062e897deedcd9248bc04e9baaa2fc7b464e2595dcaeff2af0818387bf1fcdbf6f
Diffstat (limited to 'src/wallet/walletutil.cpp')
0 files changed, 0 insertions, 0 deletions