@@ -1922,14 +1922,18 @@ impl Wallet {
19221922 . unwrap_or_else ( || self . chain . tip ( ) . height ( ) ) ;
19231923
19241924 Ok ( self
1925- . try_finalize_psbt_with ( psbt, |_, input| {
1926- Some ( (
1927- current_height,
1928- confirmation_heights
1929- . get ( & input. previous_output . txid )
1930- . copied ( ) ,
1931- ) )
1932- } ) ?
1925+ . try_finalize_psbt_with (
1926+ psbt,
1927+ |_, input| {
1928+ Some ( (
1929+ current_height,
1930+ confirmation_heights
1931+ . get ( & input. previous_output . txid )
1932+ . copied ( ) ,
1933+ ) )
1934+ } ,
1935+ true ,
1936+ ) ?
19331937 . is_finalized ( ) )
19341938 }
19351939
@@ -1942,13 +1946,14 @@ impl Wallet {
19421946 & self ,
19431947 psbt : & mut Psbt ,
19441948 ) -> Result < FinalizePsbtOutcome , IndexOutOfBoundsError > {
1945- self . try_finalize_psbt_with ( psbt, |_, _| None )
1949+ self . try_finalize_psbt_with ( psbt, |_, _| None , false )
19461950 }
19471951
19481952 fn try_finalize_psbt_with < F > (
19491953 & self ,
19501954 psbt : & mut Psbt ,
19511955 mut wallet_timelocks : F ,
1956+ clear_output_derivations : bool ,
19521957 ) -> Result < FinalizePsbtOutcome , IndexOutOfBoundsError >
19531958 where
19541959 F : FnMut ( usize , & bitcoin:: TxIn ) -> Option < ( u32 , Option < u32 > ) > ,
@@ -2037,9 +2042,8 @@ impl Wallet {
20372042 }
20382043 }
20392044
2040- // Clear derivation paths from outputs.
20412045 let finalized = FinalizePsbtOutcome :: new ( outcomes) ;
2042- if finalized. is_finalized ( ) {
2046+ if clear_output_derivations && finalized. is_finalized ( ) {
20432047 for output in & mut psbt. outputs {
20442048 output. bip32_derivation . clear ( ) ;
20452049 output. tap_key_origins . clear ( ) ;
0 commit comments