11use crate :: builder:: NodeBuilder ;
2+ use crate :: io:: sqlite_store:: { self , SqliteStore } ;
23use crate :: io:: test_utils:: TestSyncStore ;
34use crate :: { Config , Node } ;
45use lightning:: util:: logger:: { Level , Logger , Record } ;
@@ -176,7 +177,7 @@ pub fn setup_bitcoind_and_electrsd() -> (BitcoinD, ElectrsD) {
176177
177178pub ( crate ) fn setup_two_nodes (
178179 electrsd : & ElectrsD , allow_0conf : bool ,
179- ) -> ( Node < TestSyncStore > , Node < TestSyncStore > ) {
180+ ) -> ( Node < SqliteStore > , Node < SqliteStore > ) {
180181 println ! ( "== Node A ==" ) ;
181182 let config_a = random_config ( ) ;
182183 let node_a = setup_node ( electrsd, config_a) ;
@@ -190,12 +191,22 @@ pub(crate) fn setup_two_nodes(
190191 ( node_a, node_b)
191192}
192193
193- pub ( crate ) fn setup_node ( electrsd : & ElectrsD , config : Config ) -> Node < TestSyncStore > {
194+ pub ( crate ) fn setup_node ( electrsd : & ElectrsD , config : Config ) -> Node < SqliteStore > {
194195 let esplora_url = format ! ( "http://{}" , electrsd. esplora_url. as_ref( ) . unwrap( ) ) ;
195196 let mut builder = NodeBuilder :: from_config ( config. clone ( ) ) ;
196197 builder. set_esplora_server ( esplora_url. clone ( ) ) ;
197- let test_sync_store = Arc :: new ( TestSyncStore :: new ( config. storage_dir_path . into ( ) ) ) ;
198- let node = builder. build_with_store ( test_sync_store) . unwrap ( ) ;
198+
199+ let mut sql_dir = PathBuf :: from ( config. storage_dir_path ) ;
200+ sql_dir. push ( "sqlite_store" ) ;
201+ let sqlite_store = Arc :: new (
202+ SqliteStore :: new (
203+ sql_dir,
204+ Some ( "test_sync_db" . to_string ( ) ) ,
205+ Some ( "test_sync_table" . to_string ( ) ) ,
206+ )
207+ . unwrap ( ) ,
208+ ) ;
209+ let node = builder. build_with_store ( sqlite_store) . unwrap ( ) ;
199210 node. start ( ) . unwrap ( ) ;
200211 node
201212}
0 commit comments