@@ -47,7 +47,7 @@ use error::{
47
47
} ;
48
48
use optional_parameters:: Params ;
49
49
50
- use crate :: psbt:: { InputPair , InternalInputPair , PsbtExt } ;
50
+ use crate :: psbt:: { InputPair , PsbtExt } ;
51
51
52
52
pub trait Headers {
53
53
fn get_header ( & self , key : & str ) -> Option < & str > ;
@@ -507,16 +507,14 @@ impl WantsInputs {
507
507
let prior_payment_sats = self . payjoin_psbt . unsigned_tx . output [ self . change_vout ] . value ;
508
508
509
509
for input_pair in candidate_inputs {
510
- let input_pair = InternalInputPair :: from ( & input_pair) ;
511
- let candidate_sats =
512
- input_pair. previous_txout ( ) . map_err ( InternalSelectionError :: PrevTxOut ) ?. value ;
510
+ let candidate_sats = input_pair. previous_txout ( ) . value ;
513
511
let candidate_min_out = min ( min_original_out_sats, prior_payment_sats + candidate_sats) ;
514
512
let candidate_min_in = min ( min_original_in_sats, candidate_sats) ;
515
513
516
514
if candidate_min_in > candidate_min_out {
517
515
// The candidate avoids UIH2 but conforms to UIH1: Optimal change heuristic.
518
516
// It implies the smallest output is the sender's change address.
519
- return Ok ( InputPair :: from ( & input_pair) ) ;
517
+ return Ok ( input_pair) ;
520
518
}
521
519
}
522
520
@@ -555,7 +553,6 @@ impl WantsInputs {
555
553
let mut rng = rand:: thread_rng ( ) ;
556
554
let mut receiver_input_amount = Amount :: ZERO ;
557
555
for input_pair in inputs. into_iter ( ) {
558
- let input_pair = InternalInputPair :: from ( & input_pair) ;
559
556
let input_type =
560
557
input_pair. address_type ( ) . map_err ( InternalInputContributionError :: AddressType ) ?;
561
558
@@ -564,16 +561,13 @@ impl WantsInputs {
564
561
self . check_mixed_input_types ( input_type, uniform_sender_input_type) ?;
565
562
}
566
563
567
- receiver_input_amount += input_pair
568
- . previous_txout ( )
569
- . map_err ( InternalInputContributionError :: PrevTxOut ) ?
570
- . value ;
564
+ receiver_input_amount += input_pair. previous_txout ( ) . value ;
571
565
let index = rng. gen_range ( 0 ..=self . payjoin_psbt . unsigned_tx . input . len ( ) ) ;
572
- payjoin_psbt. inputs . insert ( index, input_pair. psbtin . clone ( ) ) ;
566
+ payjoin_psbt. inputs . insert ( index, input_pair. psbtin ( ) . clone ( ) ) ;
573
567
payjoin_psbt
574
568
. unsigned_tx
575
569
. input
576
- . insert ( index, TxIn { sequence : original_sequence, ..input_pair. txin . clone ( ) } ) ;
570
+ . insert ( index, TxIn { sequence : original_sequence, ..input_pair. txin ( ) . clone ( ) } ) ;
577
571
}
578
572
579
573
// Add the receiver change amount to the receiver change output, if applicable
0 commit comments