@@ -76,6 +76,9 @@ pub struct PsbtInputInfo {
7676 #[ serde( skip_serializing_if = "Option::is_none" ) ]
7777 pub witness_script : Option < tx:: OutputScriptInfo > ,
7878 #[ serde( skip_serializing_if = "HashMap::is_empty" ) ]
79+ pub bip32_derivation : HashMap < HexBytes , HDPathInfo > ,
80+ #[ deprecated( since = "0.9.5" , note = "use bip32_derivation instead" ) ]
81+ #[ serde( skip_serializing_if = "HashMap::is_empty" ) ]
7982 pub hd_keypaths : HashMap < HexBytes , HDPathInfo > ,
8083 #[ serde( skip_serializing_if = "Option::is_none" ) ]
8184 pub final_script_sig : Option < tx:: InputScriptInfo > ,
@@ -85,6 +88,19 @@ pub struct PsbtInputInfo {
8588
8689impl GetInfo < PsbtInputInfo > for psbt:: Input {
8790 fn get_info ( & self , network : Network ) -> PsbtInputInfo {
91+ let bip32_derivation = {
92+ let mut ret = HashMap :: new ( ) ;
93+ for ( key, value) in self . bip32_derivation . iter ( ) {
94+ ret. insert ( key. serialize ( ) . to_vec ( ) . into ( ) ,
95+ HDPathInfo {
96+ master_fingerprint : value. 0 [ ..] . into ( ) ,
97+ path : value. 1 . clone ( ) ,
98+ } ,
99+ ) ;
100+ }
101+ ret
102+ } ;
103+ #[ allow( deprecated) ] // for hd_keypaths
88104 PsbtInputInfo {
89105 non_witness_utxo : self . non_witness_utxo . as_ref ( ) . map ( |u| u. get_info ( network) ) ,
90106 witness_utxo : self . witness_utxo . as_ref ( ) . map ( |u| u. get_info ( network) ) ,
@@ -100,18 +116,8 @@ impl GetInfo<PsbtInputInfo> for psbt::Input {
100116 . map ( |s| tx:: OutputScript ( s) . get_info ( network) ) ,
101117 witness_script : self . witness_script . as_ref ( )
102118 . map ( |s| tx:: OutputScript ( s) . get_info ( network) ) ,
103- hd_keypaths : {
104- let mut hd_keypaths = HashMap :: new ( ) ;
105- for ( key, value) in self . bip32_derivation . iter ( ) {
106- hd_keypaths. insert ( key. serialize ( ) . to_vec ( ) . into ( ) ,
107- HDPathInfo {
108- master_fingerprint : value. 0 [ ..] . into ( ) ,
109- path : value. 1 . clone ( ) ,
110- } ,
111- ) ;
112- }
113- hd_keypaths
114- } ,
119+ bip32_derivation : bip32_derivation. clone ( ) ,
120+ hd_keypaths : bip32_derivation,
115121 final_script_sig : self . final_script_sig . as_ref ( )
116122 . map ( |s| tx:: InputScript ( s) . get_info ( network) ) ,
117123 final_script_witness : self . final_script_witness . as_ref ( )
0 commit comments