@@ -134,7 +134,6 @@ def deserialize(self, f: Readable) -> None:
134
134
utxo_bytes = BufferedReader (BytesIO (deser_string (f ))) # type: ignore
135
135
self .non_witness_utxo .deserialize (utxo_bytes )
136
136
self .non_witness_utxo .rehash ()
137
-
138
137
elif key_type == 1 :
139
138
if key in key_lookup :
140
139
raise PSBTSerializationError ("Duplicate Key, input witness utxo already provided" )
@@ -143,7 +142,6 @@ def deserialize(self, f: Readable) -> None:
143
142
self .witness_utxo = CTxOut ()
144
143
tx_out_bytes = BufferedReader (BytesIO (deser_string (f ))) # type: ignore
145
144
self .witness_utxo .deserialize (tx_out_bytes )
146
-
147
145
elif key_type == 2 :
148
146
if len (key ) != 34 and len (key ) != 66 :
149
147
raise PSBTSerializationError ("Size of key was not the expected size for the type partial signature pubkey" )
@@ -153,47 +151,40 @@ def deserialize(self, f: Readable) -> None:
153
151
154
152
sig = deser_string (f )
155
153
self .partial_sigs [pubkey ] = sig
156
-
157
154
elif key_type == 3 :
158
155
if key in key_lookup :
159
156
raise PSBTSerializationError ("Duplicate key, input sighash type already provided" )
160
157
elif len (key ) != 1 :
161
158
raise PSBTSerializationError ("sighash key is more than one byte type" )
162
159
sighash_bytes = deser_string (f )
163
160
self .sighash = struct .unpack ("<I" , sighash_bytes )[0 ]
164
-
165
161
elif key_type == 4 :
166
162
if key in key_lookup :
167
163
raise PSBTSerializationError ("Duplicate key, input redeemScript already provided" )
168
164
elif len (key ) != 1 :
169
165
raise PSBTSerializationError ("redeemScript key is more than one byte type" )
170
166
self .redeem_script = deser_string (f )
171
-
172
167
elif key_type == 5 :
173
168
if key in key_lookup :
174
169
raise PSBTSerializationError ("Duplicate key, input witnessScript already provided" )
175
170
elif len (key ) != 1 :
176
171
raise PSBTSerializationError ("witnessScript key is more than one byte type" )
177
172
self .witness_script = deser_string (f )
178
-
179
173
elif key_type == 6 :
180
174
DeserializeHDKeypath (f , key , self .hd_keypaths , [34 , 66 ])
181
-
182
175
elif key_type == 7 :
183
176
if key in key_lookup :
184
177
raise PSBTSerializationError ("Duplicate key, input final scriptSig already provided" )
185
178
elif len (key ) != 1 :
186
179
raise PSBTSerializationError ("final scriptSig key is more than one byte type" )
187
180
self .final_script_sig = deser_string (f )
188
-
189
181
elif key_type == 8 :
190
182
if key in key_lookup :
191
183
raise PSBTSerializationError ("Duplicate key, input final scriptWitness already provided" )
192
184
elif len (key ) != 1 :
193
185
raise PSBTSerializationError ("final scriptWitness key is more than one byte type" )
194
186
witness_bytes = BufferedReader (BytesIO (deser_string (f ))) # type: ignore
195
187
self .final_script_witness .deserialize (witness_bytes )
196
-
197
188
else :
198
189
if key in self .unknown :
199
190
raise PSBTSerializationError ("Duplicate key, key for unknown value already provided" )
@@ -303,17 +294,14 @@ def deserialize(self, f: Readable) -> None:
303
294
elif len (key ) != 1 :
304
295
raise PSBTSerializationError ("Output redeemScript key is more than one byte type" )
305
296
self .redeem_script = deser_string (f )
306
-
307
297
elif key_type == 1 :
308
298
if key in key_lookup :
309
299
raise PSBTSerializationError ("Duplicate key, output witnessScript already provided" )
310
300
elif len (key ) != 1 :
311
301
raise PSBTSerializationError ("Output witnessScript key is more than one byte type" )
312
302
self .witness_script = deser_string (f )
313
-
314
303
elif key_type == 2 :
315
304
DeserializeHDKeypath (f , key , self .hd_keypaths , [34 , 66 ])
316
-
317
305
else :
318
306
if key in self .unknown :
319
307
raise PSBTSerializationError ("Duplicate key, key for unknown value already provided" )
0 commit comments