@@ -31,7 +31,7 @@ use bitcoin::psbt::Psbt;
31
31
use bitcoin:: secp256k1:: rand;
32
32
#[ cfg( feature = "v2" ) ]
33
33
use bitcoin:: secp256k1:: PublicKey ;
34
- use bitcoin:: { AddressType , Amount , FeeRate , Script , ScriptBuf , Sequence , TxOut , Weight } ;
34
+ use bitcoin:: { Amount , FeeRate , Script , ScriptBuf , TxOut , Weight } ;
35
35
pub use error:: { CreateRequestError , ResponseError , ValidationError } ;
36
36
pub ( crate ) use error:: { InternalCreateRequestError , InternalValidationError } ;
37
37
#[ cfg( feature = "v2" ) ]
@@ -225,22 +225,12 @@ impl<'a> RequestBuilder<'a> {
225
225
) ?;
226
226
clear_unneeded_fields ( & mut psbt) ;
227
227
228
- let zeroth_input = psbt. input_pairs ( ) . next ( ) . ok_or ( InternalCreateRequestError :: NoInputs ) ?;
229
-
230
- let sequence = zeroth_input. txin . sequence ;
231
- let input_type = zeroth_input
232
- . address_type ( )
233
- . map_err ( InternalCreateRequestError :: AddressType ) ?
234
- . to_string ( ) ;
235
-
236
228
Ok ( RequestContext {
237
229
psbt,
238
230
endpoint,
239
231
disable_output_substitution,
240
232
fee_contribution,
241
233
payee,
242
- input_type,
243
- sequence,
244
234
min_fee_rate : self . min_fee_rate ,
245
235
#[ cfg( feature = "v2" ) ]
246
236
e : crate :: v2:: HpkeKeyPair :: gen_keypair ( ) . secret_key ( ) . clone ( ) ,
@@ -256,8 +246,6 @@ pub struct RequestContext {
256
246
disable_output_substitution : bool ,
257
247
fee_contribution : Option < ( bitcoin:: Amount , usize ) > ,
258
248
min_fee_rate : FeeRate ,
259
- input_type : String ,
260
- sequence : Sequence ,
261
249
payee : ScriptBuf ,
262
250
#[ cfg( feature = "v2" ) ]
263
251
e : crate :: v2:: HpkeSecretKey ,
@@ -282,8 +270,6 @@ impl RequestContext {
282
270
disable_output_substitution : self . disable_output_substitution ,
283
271
fee_contribution : self . fee_contribution ,
284
272
payee : self . payee . clone ( ) ,
285
- input_type : AddressType :: from_str ( & self . input_type ) . expect ( "Unknown address type" ) ,
286
- sequence : self . sequence ,
287
273
min_fee_rate : self . min_fee_rate ,
288
274
} ,
289
275
) )
@@ -352,9 +338,6 @@ impl RequestContext {
352
338
disable_output_substitution : self . disable_output_substitution ,
353
339
fee_contribution : self . fee_contribution ,
354
340
payee : self . payee . clone ( ) ,
355
- input_type : AddressType :: from_str ( & self . input_type )
356
- . expect ( "Unknown address type" ) ,
357
- sequence : self . sequence ,
358
341
min_fee_rate : self . min_fee_rate ,
359
342
} ,
360
343
rs : Some ( self . extract_rs_pubkey ( ) ?) ,
@@ -397,8 +380,6 @@ pub struct ContextV1 {
397
380
disable_output_substitution : bool ,
398
381
fee_contribution : Option < ( bitcoin:: Amount , usize ) > ,
399
382
min_fee_rate : FeeRate ,
400
- input_type : AddressType ,
401
- sequence : Sequence ,
402
383
payee : ScriptBuf ,
403
384
}
404
385
@@ -565,6 +546,11 @@ impl ContextV1 {
565
546
}
566
547
// theirs (receiver)
567
548
None | Some ( _) => {
549
+ let original = self
550
+ . original_psbt
551
+ . input_pairs ( )
552
+ . next ( )
553
+ . expect ( "original PSBT should have an input" ) ;
568
554
// Verify the PSBT input is finalized
569
555
ensure ! (
570
556
proposed. psbtin. final_script_sig. is_some( )
@@ -577,8 +563,8 @@ impl ContextV1 {
577
563
|| proposed. psbtin. non_witness_utxo. is_some( ) ,
578
564
ReceiverTxinMissingUtxoInfo
579
565
) ;
580
- ensure ! ( proposed. txin. sequence == self . sequence, MixedSequence ) ;
581
- check_eq ! ( proposed. address_type( ) ?, self . input_type , MixedInputTypes ) ;
566
+ ensure ! ( proposed. txin. sequence == original . txin . sequence, MixedSequence ) ;
567
+ check_eq ! ( proposed. address_type( ) ?, original . address_type ( ) ? , MixedInputTypes ) ;
582
568
}
583
569
}
584
570
}
@@ -855,8 +841,6 @@ mod test {
855
841
fee_contribution : Some ( ( bitcoin:: Amount :: from_sat ( 182 ) , 0 ) ) ,
856
842
min_fee_rate : FeeRate :: ZERO ,
857
843
payee,
858
- input_type : bitcoin:: AddressType :: P2sh ,
859
- sequence,
860
844
} ;
861
845
ctx
862
846
}
@@ -911,8 +895,6 @@ mod test {
911
895
disable_output_substitution : false ,
912
896
fee_contribution : None ,
913
897
min_fee_rate : FeeRate :: ZERO ,
914
- input_type : bitcoin:: AddressType :: P2sh . to_string ( ) ,
915
- sequence : Sequence :: MAX ,
916
898
payee : ScriptBuf :: from ( vec ! [ 0x00 ] ) ,
917
899
e : HpkeSecretKey (
918
900
<hpke:: kem:: SecpK256HkdfSha256 as hpke:: Kem >:: PrivateKey :: from_bytes ( & [ 0x01 ; 32 ] )
0 commit comments