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> {
6060 Self {
6161 internal_key : self . internal_key . clone ( ) ,
6262 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+ ) ,
6470 }
6571 }
6672}
@@ -216,7 +222,7 @@ impl<Pk: MiniscriptKey> Tr<Pk> {
216222 // read only panics if the lock is poisoned (meaning other thread having a lock panicked)
217223 let read_lock = self . spend_info . lock ( ) . expect ( "Lock poisoned" ) ;
218224 if let Some ( ref spend_info) = * read_lock {
219- return spend_info . clone ( ) ;
225+ return Arc :: clone ( spend_info ) ;
220226 }
221227 drop ( read_lock) ;
222228
@@ -260,7 +266,7 @@ impl<Pk: MiniscriptKey> Tr<Pk> {
260266 }
261267 } ;
262268 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 ) ) ;
264270 spend_info
265271 }
266272}
You can’t perform that action at this time.
0 commit comments