]> Untitled Git - bdk-cli/commitdiff
Fix duplicate wallet creation in non-persistent path
authorMshehu5 <musheu@gmail.com>
Thu, 1 Jan 2026 21:13:01 +0000 (22:13 +0100)
committerMshehu5 <musheu@gmail.com>
Mon, 5 Jan 2026 11:35:41 +0000 (12:35 +0100)
The non-persistent wallet path (when sqlite/redb features are
disabled) was creating the wallet twice: first as immutable to
create the blockchain_client, then again as mutable. This caused
the blockchain_client to be initialized with the first wallet
instance, but then used with the second wallet instance, creating
a mismatch.

src/handlers.rs

index 4631186c666ac5e5fa510e7673a3598b937e1582..5439bc0a272b2881d8a9549639ad2cf43bfacf0a 100644 (file)
@@ -999,10 +999,9 @@ pub(crate) async fn handle_command(cli_opts: CliOpts) -> Result<String, Error> {
             };
             #[cfg(not(any(feature = "sqlite", feature = "redb")))]
             let result = {
-                let wallet = new_wallet(network, wallet_opts)?;
+                let mut wallet = new_wallet(network, wallet_opts)?;
                 let blockchain_client =
                     crate::utils::new_blockchain_client(wallet_opts, &wallet, database_path)?;
-                let mut wallet = new_wallet(network, wallet_opts)?;
                 handle_online_wallet_subcommand(&mut wallet, blockchain_client, online_subcommand)
                     .await?
             };