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) {
91
91
if is_spent {
92
92
break ;
93
93
}
94
+
94
95
is_spent = exponential_backoff_poll ( || {
95
96
get_electrsd ( ) . trigger ( ) . unwrap ( ) ;
96
97
get_electrsd ( ) . client . ping ( ) . unwrap ( ) ;
@@ -104,13 +105,18 @@ where
104
105
F : FnMut ( ) -> Option < T > ,
105
106
{
106
107
let mut delay = Duration :: from_millis ( 64 ) ;
108
+ let mut tries = 0 ;
107
109
loop {
108
110
match poll ( ) {
109
111
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
+
111
116
None => { }
112
117
}
113
-
118
+ assert ! ( tries < 10 , "Reached max tries." ) ;
119
+ tries += 1 ;
114
120
std:: thread:: sleep ( delay) ;
115
121
}
116
122
}
You can’t perform that action at this time.
0 commit comments