In the RPC method:
https://github.com/bitcoin/bitcoin/blob/master/src/wallet/rpc/wallet.cpp
When the RPC method "loadwallet" is called, it will call loadwallet(https://github.com/bitcoin/bitcoin/blob/master/src/wallet/wallet.cpp)
and LoadWalletInternal. When the user repeatedly call the loadwallet with same wallet name. In the LoadWalletInternal funcntion, although it does not call Addwallet repeatedly to add to context.wallets and avoid open SQLite database repeatedly. But it will make new SQLiteDatabase unique_ptr and do some series checks.
Is it better to use GetWallet to determine if the wallet is already loaded before calling LoadWalletInternal?
-
guoyl commented at 1:45 AM on June 20, 2022: none
- guoyl added the label Feature on Jun 20, 2022
- MarcoFalke removed the label Feature on Jun 20, 2022
- MarcoFalke added the label Wallet on Jun 20, 2022
- MarcoFalke added the label Questions and Help on Jun 20, 2022
-
furszy commented at 7:00 PM on August 4, 2022: member
The "name" parameter in
loadwalletisn't just a simple name. Could be a:- Path where a directory can be created.
- Path to an existing directory.
- Path to a symlink to a directory.
- The name of a data file in
-walletdir.
So, depends on how the wallet was initially loaded (from which of those options), the stored "wallet name" inside the wallet class will be different. So, only a
GetWallet(name)check before loading the db wouldn't work if you load the same wallet in two different ways. Eg: load a wallet by name first (location inside-walletdir), then load it by its path. -
adamjonas commented at 12:21 AM on August 5, 2022: member
Closing based on furszy response.
- adamjonas closed this on Aug 5, 2022
- bitcoin locked this on Aug 5, 2023
Labels