File tree Expand file tree Collapse file tree 1 file changed +8
-2
lines changed Expand file tree Collapse file tree 1 file changed +8
-2
lines changed Original file line number Diff line number Diff line change @@ -91,6 +91,7 @@ fn wait_for_outpoint_spend(outpoint: OutPoint) {
9191 if is_spent {
9292 break ;
9393 }
94+
9495 is_spent = exponential_backoff_poll ( || {
9596 get_electrsd ( ) . trigger ( ) . unwrap ( ) ;
9697 get_electrsd ( ) . client . ping ( ) . unwrap ( ) ;
@@ -104,13 +105,18 @@ where
104105 F : FnMut ( ) -> Option < T > ,
105106{
106107 let mut delay = Duration :: from_millis ( 64 ) ;
108+ let mut tries = 0 ;
107109 loop {
108110 match poll ( ) {
109111 Some ( data) => break data,
110- None if delay. as_millis ( ) < 512 => delay = delay. mul_f32 ( 2.0 ) ,
112+ None if delay. as_millis ( ) < 512 => {
113+ delay = delay. mul_f32 ( 2.0 ) ;
114+ }
115+
111116 None => { }
112117 }
113-
118+ assert ! ( tries < 10 , "Reached max tries." ) ;
119+ tries += 1 ;
114120 std:: thread:: sleep ( delay) ;
115121 }
116122}
You can’t perform that action at this time.
0 commit comments