@@ -1228,25 +1228,25 @@ impl LightWallet {
12281228 }
12291229
12301230 // Set up a channel to recieve updates on the progress of building the transaction.
1231- // let (tx, rx) = channel::<u32>();
1232- // let progress = self.send_progress.clone();
1231+ let ( tx, rx) = channel :: < u32 > ( ) ;
1232+ let progress = self . send_progress . clone ( ) ;
12331233
12341234 // Use a separate thread to handle sending from std::mpsc to tokio::sync::mpsc
1235- // let (tx2, mut rx2) = tokio::sync::mpsc::unbounded_channel();
1236- // std::thread::spawn(move || {
1237- // while let Ok(r) = rx.recv() {
1238- // tx2.send(r).unwrap();
1239- // }
1240- // });
1241-
1242- // let progress_handle = tokio::spawn(async move {
1243- // while let Some(r) = rx2.recv().await {
1244- // println!("Progress: {}", r);
1245- // progress.write().await.progress = r;
1246- // }
1247-
1248- // progress.write().await.is_send_in_progress = false;
1249- // });
1235+ let ( tx2, mut rx2) = tokio:: sync:: mpsc:: unbounded_channel ( ) ;
1236+ std:: thread:: spawn ( move || {
1237+ while let Ok ( r) = rx. recv ( ) {
1238+ tx2. send ( r) . unwrap ( ) ;
1239+ }
1240+ } ) ;
1241+
1242+ let progress_handle = tokio:: spawn ( async move {
1243+ while let Some ( r) = rx2. recv ( ) . await {
1244+ println ! ( "Progress: {}" , r) ;
1245+ progress. write ( ) . await . progress = r;
1246+ }
1247+
1248+ progress. write ( ) . await . is_send_in_progress = false ;
1249+ } ) ;
12501250
12511251 {
12521252 let mut p = self . send_progress . write ( ) . await ;
@@ -1256,10 +1256,10 @@ impl LightWallet {
12561256 }
12571257
12581258 println ! ( "{}: Building transaction" , now( ) - start_time) ;
1259- let ( tx, _) = match builder. build (
1259+ let ( tx, _) = match builder. build_with_progress_notifier (
12601260 BranchId :: try_from ( consensus_branch_id) . unwrap ( ) ,
12611261 & prover,
1262- // Some(tx),
1262+ Some ( tx) ,
12631263 ) {
12641264 Ok ( res) => res,
12651265 Err ( e) => {
@@ -1271,7 +1271,7 @@ impl LightWallet {
12711271 } ;
12721272
12731273 // Wait for all the progress to be updated
1274- // progress_handle.await.unwrap();
1274+ progress_handle. await . unwrap ( ) ;
12751275
12761276 println ! ( "{}: Transaction created" , now( ) - start_time) ;
12771277 println ! ( "Transaction ID: {}" , tx. txid( ) ) ;
0 commit comments