File tree Expand file tree Collapse file tree 1 file changed +9
-3
lines changed Expand file tree Collapse file tree 1 file changed +9
-3
lines changed Original file line number Diff line number Diff line change @@ -60,7 +60,13 @@ impl<Pk: MiniscriptKey> Clone for Tr<Pk> {
60
60
Self {
61
61
internal_key : self . internal_key . clone ( ) ,
62
62
tree : self . tree . clone ( ) ,
63
- spend_info : Mutex :: new ( self . spend_info . lock ( ) . expect ( "Lock poisoned" ) . clone ( ) ) ,
63
+ spend_info : Mutex :: new (
64
+ self . spend_info
65
+ . lock ( )
66
+ . expect ( "Lock poisoned" )
67
+ . as_ref ( )
68
+ . map ( Arc :: clone) ,
69
+ ) ,
64
70
}
65
71
}
66
72
}
@@ -216,7 +222,7 @@ impl<Pk: MiniscriptKey> Tr<Pk> {
216
222
// read only panics if the lock is poisoned (meaning other thread having a lock panicked)
217
223
let read_lock = self . spend_info . lock ( ) . expect ( "Lock poisoned" ) ;
218
224
if let Some ( ref spend_info) = * read_lock {
219
- return spend_info . clone ( ) ;
225
+ return Arc :: clone ( spend_info ) ;
220
226
}
221
227
drop ( read_lock) ;
222
228
@@ -260,7 +266,7 @@ impl<Pk: MiniscriptKey> Tr<Pk> {
260
266
}
261
267
} ;
262
268
let spend_info = Arc :: new ( data) ;
263
- * self . spend_info . lock ( ) . expect ( "Lock poisoned" ) = Some ( spend_info . clone ( ) ) ;
269
+ * self . spend_info . lock ( ) . expect ( "Lock poisoned" ) = Some ( Arc :: clone ( & spend_info ) ) ;
264
270
spend_info
265
271
}
266
272
}
You can’t perform that action at this time.
0 commit comments