@@ -872,7 +872,6 @@ impl<S: MutinyStorage> MutinyWalletBuilder<S> {
872872
873873 let mut nm_builder = NodeManagerBuilder :: new ( self . xprivkey , self . storage . clone ( ) )
874874 . with_config ( config. clone ( ) ) ;
875- nm_builder. with_stop ( stop. clone ( ) ) ;
876875 nm_builder. with_logger ( logger. clone ( ) ) ;
877876 let node_manager = Arc :: new ( nm_builder. build ( ) . await ?) ;
878877
@@ -1182,7 +1181,6 @@ impl<S: MutinyStorage> MutinyWallet<S> {
11821181
11831182 let mut nm_builder = NodeManagerBuilder :: new ( self . xprivkey , self . storage . clone ( ) )
11841183 . with_config ( self . config . clone ( ) ) ;
1185- nm_builder. with_stop ( self . stop . clone ( ) ) ;
11861184 nm_builder. with_logger ( self . logger . clone ( ) ) ;
11871185
11881186 // when we restart, gen a new session id
@@ -2347,7 +2345,18 @@ impl<S: MutinyStorage> MutinyWallet<S> {
23472345 /// Stops all of the nodes and background processes.
23482346 /// Returns after node has been stopped.
23492347 pub async fn stop ( & self ) -> Result < ( ) , MutinyError > {
2350- self . node_manager . stop ( ) . await
2348+ self . stop . store ( true , Ordering :: Relaxed ) ;
2349+
2350+ self . node_manager . stop ( ) . await ?;
2351+
2352+ // stop the indexeddb object to close db connection
2353+ if self . storage . connected ( ) . unwrap_or ( false ) {
2354+ log_debug ! ( self . logger, "stopping storage" ) ;
2355+ self . storage . stop ( ) ;
2356+ log_debug ! ( self . logger, "stopped storage" ) ;
2357+ }
2358+
2359+ Ok ( ( ) )
23512360 }
23522361
23532362 pub async fn change_password (
0 commit comments